CTerrorGameRules::GetNumChaptersForMissionAndMode
0x005097d0 · 209 bytes · __cdecl
_ZN16CTerrorGameRules31GetNumChaptersForMissionAndModeEv
Decompiled
undefined (0 params)
/* CTerrorGameRules::GetNumChaptersForMissionAndMode() */
int CTerrorGameRules::GetNumChaptersForMissionAndMode(void)
{
KeyValues *pKVar1;
int iVar2;
char *pcVar3;
int iVar4;
int in_GS_OFFSET;
CFmtStrN<256> local_11c [5];
char local_117 [263];
int local_10;
local_10 = *(int *)(in_GS_OFFSET + 0x14);
iVar4 = 0;
if (g_pMatchExtL4D != 0) {
pKVar1 = (KeyValues *)GetMissionInfo();
if (pKVar1 != (KeyValues *)0x0) {
pcVar3 = "FCVAR_NEVER_AS_STRING";
if ((mp_gamemode[0x15] & 0x10) == 0) {
pcVar3 = "";
if (*(char **)(mp_gamemode._28_4_ + 0x24) != (char *)0x0) {
pcVar3 = *(char **)(mp_gamemode._28_4_ + 0x24);
}
}
CFmtStrN<256>::CFmtStrN(local_11c,"Modes/%s",pcVar3);
pKVar1 = (KeyValues *)KeyValues::FindKey(pKVar1,local_117,false);
if (pKVar1 != (KeyValues *)0x0) {
iVar2 = KeyValues::GetInt(pKVar1,"chapters",0);
iVar4 = -1;
if (0 < iVar2) {
iVar4 = iVar2;
}
goto LAB_00509867;
}
}
iVar4 = -1;
}
LAB_00509867:
if (local_10 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return iVar4;
}
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.