DifficultyChanged
0x0051f080 · 277 bytes · __cdecl
_ZL17DifficultyChangedP7IConVarPKcf
Decompiled
undefined (3 params)
/* DifficultyChanged(IConVar*, char const*, float) */
void DifficultyChanged(IConVar *param_1,char *param_2,float param_3)
{
uint uVar1;
char cVar2;
uint uVar3;
int *piVar4;
char *pcVar5;
undefined4 *local_24;
int local_20;
ConVarRef::ConVarRef((ConVarRef *)&local_24,param_1);
uVar3 = GetDifficultyFromString(*(char **)(local_20 + 0x24));
uVar1 = s_difficulty;
if (uVar3 != 1) {
cVar2 = CTerrorGameRules::HasConfigurableDifficultySetting();
if (cVar2 == '\0') {
uVar3 = 1;
}
}
if (uVar3 != uVar1) {
s_difficulty = uVar3;
if (gameeventmanager != (int *)0x0) {
piVar4 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"difficulty_changed",0,0);
if (piVar4 != (int *)0x0) {
(**(code **)(*piVar4 + 0x30))(piVar4,"newDifficulty",uVar3);
(**(code **)(*piVar4 + 0x30))(piVar4,"oldDifficulty",uVar1);
pcVar5 = "Unknown";
if (uVar3 < 4) {
pcVar5 = (&sDifficultyStrings)[uVar3];
}
(**(code **)(*piVar4 + 0x3c))(piVar4,"strDifficulty",pcVar5);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar4,0);
}
}
pcVar5 = "Unknown";
if (uVar3 < 4) {
pcVar5 = (&sDifficultyStrings)[uVar3];
}
(**(code **)*local_24)(local_24,pcVar5);
}
return;
}
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.