L L4D2node

CTerrorGameRules::CTerrorGameRules

0x0050a260 · 1576 bytes · __thiscall

_ZN16CTerrorGameRulesC1Ev

Decompiled

undefined (1 param)

/* CTerrorGameRules::CTerrorGameRules() */

void __thiscall CTerrorGameRules::CTerrorGameRules(CTerrorGameRules *this)

{
  CTerrorGameRules CVar1;
  char cVar2;
  int iVar3;
  KeyValues *pKVar4;
  char *pcVar5;
  int iVar6;
  CUtlMemory<unsigned_char,int> *this_00;
  int local_50 [4];
  int local_40 [4];
  int local_30;
  undefined4 local_2c;
  undefined4 local_28;
  int local_24;
  int local_20;
  
  CCSGameRules::CCSGameRules((CCSGameRules *)this);
  *(undefined ***)this = &PTR_Name_00c2afe8;
  *(undefined4 *)(this + 0x2e8) = 0;
  *(undefined4 *)(this + 0x2ec) = 0;
  *(undefined4 *)(this + 0x2f0) = 0;
  *(undefined4 *)(this + 0x2f4) = 0;
  *(undefined4 *)(this + 0x2f8) = 0;
  *(undefined4 *)(this + 0x304) = 0;
  *(undefined ***)(this + 0x2fc) = &PTR_Run_00c2ac18;
  *(undefined4 *)(this + 0x310) = 0;
  this[0x300] = (CTerrorGameRules)0x2;
  *(CTerrorGameRules **)(this + 0x308) = this;
  *(code **)(this + 0x30c) = OnGSGetGameplayStatsResponse;
                    /* try { // try from 0050a2f5 to 0050a2f9 has its CatchHandler @ 0050a97b */
  SteamAPI_RegisterCallback(this + 0x2fc,0xcf);
  *(undefined4 *)(this + 0x314) = 0xffffffff;
  iVar3 = 0;
  *(undefined4 *)(this + 0x378) = 0;
  *(undefined4 *)(this + 0x37c) = 0;
  *(undefined4 *)(this + 0x380) = 0;
  *(undefined4 *)(this + 900) = 0;
  *(undefined4 *)(this + 0x388) = 0;
  *(undefined4 *)(this + 0x268) = 0;
  *(undefined4 *)(this + 0x318) = 0;
  *(undefined4 *)(this + 0x31c) = 0;
  *(undefined4 *)(this + 800) = 0;
  *(undefined4 *)(this + 0x324) = 0;
  *(undefined4 *)(this + 0x328) = 0;
  *(undefined4 *)(this + 0x32c) = 0;
  do {
    *(undefined4 *)(this + iVar3 * 4 + 0x330) = 0;
    *(undefined4 *)(this + iVar3 * 4 + 0x354) = 0;
    iVar3 = iVar3 + 1;
  } while (iVar3 != 9);
                    /* try { // try from 0050a3a9 to 0050a608 has its CatchHandler @ 0050a8f3 */
  ClearTeamScores(this,true);
  if (*(float *)(this + 0x444) == 0.0) {
    if (*(float *)(this + 0x448) != 0.0) goto LAB_0050a56f;
LAB_0050a3ce:
    if (*(float *)(this + 0x44c) != 0.0) goto LAB_0050a58e;
LAB_0050a3de:
    if (*(float *)(this + 0x46c) != 0.0) goto LAB_0050a5ad;
LAB_0050a3ee:
    if (*(int *)(this + 0x478) != 0) goto LAB_0050a5ca;
LAB_0050a3fc:
    if (*(int *)(this + 0x47c) != 0) goto LAB_0050a5e7;
LAB_0050a40a:
    iVar3 = *(int *)(this + 0x450);
  }
  else {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x444) = 0;
    if (*(float *)(this + 0x448) == 0.0) goto LAB_0050a3ce;
LAB_0050a56f:
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x448) = 0;
    if (*(float *)(this + 0x44c) == 0.0) goto LAB_0050a3de;
LAB_0050a58e:
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x44c) = 0;
    if (*(float *)(this + 0x46c) == 0.0) goto LAB_0050a3ee;
LAB_0050a5ad:
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x46c) = 0;
    if (*(int *)(this + 0x478) == 0) goto LAB_0050a3fc;
LAB_0050a5ca:
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x478) = 0;
    if (*(int *)(this + 0x47c) == 0) goto LAB_0050a40a;
LAB_0050a5e7:
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x47c) = 0;
    iVar3 = *(int *)(this + 0x450);
  }
  if (iVar3 != 0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x450) = 0;
  }
  iVar3 = *(int *)(mp_roundlimit._28_4_ + 0x30);
  if (iVar3 != *(int *)(this + 0x454)) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(int *)(this + 0x454) = iVar3;
  }
  if (*(int *)(this + 0x480) != 0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x480) = 0;
  }
  if (*(int *)(this + 0x484) != 0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x484) = 0;
  }
  if (*(int *)(this + 0x48c) != 0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x48c) = 0;
  }
  if (this[0x490] != (CTerrorGameRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x490] = (CTerrorGameRules)0x0;
  }
  if (this[0x491] != (CTerrorGameRules)0x0) {
                    /* try { // try from 0050a74e to 0050a79c has its CatchHandler @ 0050a8f3 */
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x491] = (CTerrorGameRules)0x0;
  }
  if (this[0x492] != (CTerrorGameRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x492] = (CTerrorGameRules)0x0;
  }
  CVar1 = (CTerrorGameRules)(**(code **)(*engine + 8))(engine);
  if (CVar1 != this[0x488]) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x488] = CVar1;
  }
  ClearRoundDurations(this);
  pcVar5 = "FCVAR_NEVER_AS_STRING";
  if ((sv_gametypes[0x15] & 0x10) == 0) {
    pcVar5 = "";
    if (*(char **)(sv_gametypes._28_4_ + 0x24) != (char *)0x0) {
      pcVar5 = *(char **)(sv_gametypes._28_4_ + 0x24);
    }
  }
  if (*pcVar5 == '\0') {
    local_30 = 0;
    local_2c = 0;
    local_28 = 0;
    local_24 = 0;
    local_20 = 0;
                    /* try { // try from 0050a653 to 0050a6bc has its CatchHandler @ 0050a99d */
    pKVar4 = (KeyValues *)(**(code **)(*g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,0);
    pKVar4 = (KeyValues *)KeyValues::GetFirstTrueSubKey(pKVar4);
    for (; pKVar4 != (KeyValues *)0x0; pKVar4 = (KeyValues *)KeyValues::GetNextTrueSubKey(pKVar4)) {
      pcVar5 = (char *)KeyValues::GetString(pKVar4,"base","");
      if ((pcVar5 != (char *)0x0) && (*pcVar5 != '\0')) {
        CUtlString::CUtlString((CUtlString *)local_50,pcVar5);
        if (0 < local_24) {
          iVar3 = 0;
          do {
                    /* try { // try from 0050a6ea to 0050a6ee has its CatchHandler @ 0050a9a4 */
            cVar2 = CUtlString::operator==
                              ((CUtlString *)(iVar3 * 0x10 + local_30),(CUtlString *)local_50);
            if (cVar2 != '\0') {
              CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_50);
              goto LAB_0050a678;
            }
            iVar3 = iVar3 + 1;
          } while (iVar3 < local_24);
        }
        CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_50);
                    /* try { // try from 0050a720 to 0050a724 has its CatchHandler @ 0050a99d */
        CUtlString::CUtlString((CUtlString *)local_40,pcVar5);
                    /* try { // try from 0050a739 to 0050a73d has its CatchHandler @ 0050a9b6 */
        CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                  ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)&local_30,local_24,
                   (CUtlString *)local_40);
        CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_40);
      }
LAB_0050a678:
    }
    if (local_24 != 0) {
                    /* try { // try from 0050a7bd to 0050a7c1 has its CatchHandler @ 0050a99d */
      CUtlString::CUtlString((CUtlString *)local_40);
      iVar3 = 0;
      if (0 < local_24) {
        do {
                    /* try { // try from 0050a7d3 to 0050a81f has its CatchHandler @ 0050a898 */
          iVar6 = CUtlString::Length((CUtlString *)local_40);
          if (iVar6 != 0) {
            CUtlString::operator+=((CUtlString *)local_40,",");
          }
          CUtlString::operator+=((CUtlString *)local_40,(CUtlString *)(iVar3 * 0x10 + local_30));
          iVar3 = iVar3 + 1;
        } while (iVar3 < local_24);
      }
      CUtlString::Get((CUtlString *)local_40);
      ConVar::SetValue(sv_gametypes);
      CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_40);
      iVar3 = local_24 + -1;
      if (-1 < iVar3) {
        iVar6 = iVar3 * 0x10;
        do {
          iVar3 = iVar3 + -1;
          this_00 = (CUtlMemory<unsigned_char,int> *)(local_30 + iVar6);
          iVar6 = iVar6 + -0x10;
          CUtlMemory<unsigned_char,int>::Purge(this_00);
        } while (iVar3 != -1);
      }
    }
    local_24 = 0;
    CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)&local_30);
    local_20 = local_30;
    CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)&local_30);
  }
  if (this[0x494] != (CTerrorGameRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x494] = (CTerrorGameRules)0x0;
  }
  GetCurrentDate(local_50,local_40,&local_30);
  if (local_40[0] == 0xc) {
    if (0 < local_50[0]) goto LAB_0050a880;
  }
  else if ((local_40[0] == 1) && (local_50[0] < 3)) {
LAB_0050a880:
    this[0xdf8] = (CTerrorGameRules)0x1;
    goto LAB_0050a529;
  }
  this[0xdf8] = (CTerrorGameRules)0x0;
LAB_0050a529:
  if (this[0x495] != (CTerrorGameRules)0x1) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x495] = (CTerrorGameRules)0x1;
  }
  *(undefined4 *)(this + 0xdfc) = 400;
  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)