L L4D2node

CTeamplayRoundBasedRules::CheckRestartRound

0x004c9ba0 · 989 bytes · __thiscall

_ZN24CTeamplayRoundBasedRules17CheckRestartRoundEv

Decompiled

undefined (1 param)

/* CTeamplayRoundBasedRules::CheckRestartRound() */

void __thiscall CTeamplayRoundBasedRules::CheckRestartRound(CTeamplayRoundBasedRules *this)

{
  char cVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  char *pcVar5;
  int in_GS_OFFSET;
  float fVar6;
  char local_60 [64];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((*(int *)(mp_clan_readyrestart._28_4_ + 0x30) != 0) &&
     (*(int *)(mp_tournament._28_4_ + 0x30) == 0)) {
    if (this[0x329] != (CTeamplayRoundBasedRules)0x1) {
      CGameRulesProxy::NotifyNetworkStateChanged();
      this[0x329] = (CTeamplayRoundBasedRules)0x1;
    }
    for (iVar4 = 2; iVar3 = GetNumberOfTeams(), iVar4 < iVar3; iVar4 = iVar4 + 1) {
      if (this[iVar4 + 0x3b4] != (CTeamplayRoundBasedRules)0x0) {
        CGameRulesProxy::NotifyNetworkStateChanged();
        this[iVar4 + 0x3b4] = (CTeamplayRoundBasedRules)0x0;
      }
    }
    pcVar5 = "FCVAR_NEVER_AS_STRING";
    if ((mp_clan_ready_signal[0x15] & 0x10) == 0) {
      pcVar5 = "";
      if (*(char **)(mp_clan_ready_signal._28_4_ + 0x24) != (char *)0x0) {
        pcVar5 = *(char **)(mp_clan_ready_signal._28_4_ + 0x24);
      }
    }
    UTIL_ClientPrintAll(2,"#clan_ready_rules",pcVar5,(char *)0x0,(char *)0x0,(char *)0x0);
    UTIL_ClientPrintAll(3,"#clan_ready_rules",pcVar5,(char *)0x0,(char *)0x0,(char *)0x0);
    _V_strlen(pcVar5);
    iVar4 = (**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"teamplay_ready_restart",0,0);
    if (iVar4 != 0) {
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,iVar4,0);
    }
    ConVar::SetValue(0xf7dda0);
    if (*(float *)(this + 0x32c) != -1.0) {
      CGameRulesProxy::NotifyNetworkStateChanged();
      *(undefined4 *)(this + 0x32c) = 0xbf800000;
    }
  }
  iVar4 = *(int *)(mp_restartround._28_4_ + 0x30);
  if (iVar4 == 0) {
    iVar4 = *(int *)(mp_restartgame._28_4_ + 0x30);
  }
  if (iVar4 < 1) goto LAB_004c9d76;
  iVar3 = 0x3c;
  if (iVar4 < 0x3d) {
    iVar3 = iVar4;
  }
  this[0x268] = (CTeamplayRoundBasedRules)(0 < *(int *)(mp_restartgame._28_4_ + 0x30));
  if (this[0x3d4] != (CTeamplayRoundBasedRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x3d4] = (CTeamplayRoundBasedRules)0x0;
  }
  fVar6 = (float)iVar3 + *(float *)(gpGlobals + 0xc);
  if (fVar6 != *(float *)(this + 0x32c)) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(float *)(this + 0x32c) = fVar6;
  }
  piVar2 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                            (gameeventmanager,"teamplay_round_restart_seconds",0,0);
  if (piVar2 != (int *)0x0) {
    (**(code **)(*piVar2 + 0x30))(piVar2,"seconds",iVar3);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar2,0);
  }
  if (*(int *)(mp_tournament._28_4_ + 0x30) == 0) {
    if (*(int *)(mp_restartgame._28_4_ + 0x30) < 1) {
      if (*(int *)(mp_restartround._28_4_ + 0x30) < 1) goto LAB_004c9d45;
      pcVar5 = "#round_restart_in_secs";
      if (iVar3 == 1) {
        pcVar5 = "#round_restart_in_sec";
      }
    }
    else {
      cVar1 = (**(code **)(*(int *)this + 0x274))(this);
      if (cVar1 == '\0') {
        cVar1 = (**(code **)(*(int *)this + 0x280))(this);
        if (cVar1 == '\0') {
          pcVar5 = "#game_restart_in_secs";
          if (iVar3 == 1) {
            pcVar5 = "#game_restart_in_sec";
          }
        }
        else {
          pcVar5 = "#game_scramble_in_secs";
          if (iVar3 == 1) {
            pcVar5 = "#game_scramble_in_sec";
          }
        }
      }
      else {
        pcVar5 = "#game_switch_in_secs";
        if (iVar3 == 1) {
          pcVar5 = "#game_switch_in_sec";
        }
      }
    }
    V_snprintf(local_60,0x40,"%d",iVar3);
    UTIL_ClientPrintAll(4,pcVar5,local_60,(char *)0x0,(char *)0x0,(char *)0x0);
    UTIL_ClientPrintAll(2,pcVar5,local_60,(char *)0x0,(char *)0x0,(char *)0x0);
  }
LAB_004c9d45:
  ConVar::SetValue(0xf9e560);
  ConVar::SetValue(0xf7df20);
  if (this[0x329] != (CTeamplayRoundBasedRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x329] = (CTeamplayRoundBasedRules)0x0;
  }
LAB_004c9d76:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)