L L4D2node

CDirectorVersusMode::EndVersusModeRound

0x008c4580 · 811 bytes · __thiscall

_ZN19CDirectorVersusMode18EndVersusModeRoundEb

Decompiled

undefined (2 params)

/* CDirectorVersusMode::EndVersusModeRound(bool) */

void __thiscall CDirectorVersusMode::EndVersusModeRound(CDirectorVersusMode *this,bool param_1)

{
  char cVar1;
  KeyValues *this_00;
  int iVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  undefined4 local_3c;
  char *local_38;
  undefined1 local_34;
  KeyValues *local_30;
  undefined4 local_2c;
  char *local_28;
  undefined1 local_24;
  undefined4 local_20;
  
  cVar1 = CTerrorGameRules::IsVersusMode();
  if (cVar1 == '\0') {
    return;
  }
  if (this[4] == (CDirectorVersusMode)0x0) {
    return;
  }
  CTerrorGameRules::CalculateSurvivalMultiplier(g_pGameRules,param_1);
  CTerrorGameRules::SetRoundEndTime(g_pGameRules,*(float *)(gpGlobals + 0xc));
  uVar7 = 1;
  CTerrorGameRules::RecomputeTeamScores(g_pGameRules,true);
  if (g_pGameRules[0x491] != (CTerrorGameRules)0x0) {
    iVar6 = CTerrorGameRules::GetVersusSurvivalMultiplier(g_pGameRules,2);
    iVar2 = CTerrorGameRules::GetVersusSurvivalMultiplier(g_pGameRules,3);
    iVar4 = CTerrorGameRules::GetVersusDefibsUsed(g_pGameRules,2);
    uVar7 = 3;
    iVar5 = CTerrorGameRules::GetVersusDefibsUsed(g_pGameRules,3);
    if (((iVar6 == 4) && (iVar2 == 4)) && (iVar4 == iVar5)) {
      iVar6 = 1;
      CTerrorGameRules::RunVersusTieBreaker(g_pGameRules);
      goto LAB_008c460c;
    }
  }
  iVar6 = 0;
LAB_008c460c:
  this_00 = KeyValues::operator_new((KeyValues *)0x2c,uVar7);
                    /* try { // try from 008c4635 to 008c4639 has its CatchHandler @ 008c48bd */
  KeyValues::KeyValues(this_00,"scores",(IKeyValuesSystem *)0x0,false);
  if (this_00 == (KeyValues *)0x0) {
    local_3c = 0xffffffff;
    local_38 = "fullscreen_vs_scoreboard";
    local_34 = 1;
    local_30 = (KeyValues *)0x0;
    ForEachTerrorPlayer<CShowViewportPanel>((CShowViewportPanel *)&local_3c);
    local_2c = 0xffffffff;
    local_28 = "info_window";
    local_24 = 0;
    local_20 = 0;
    ForEachTerrorPlayer<CShowViewportPanel>((CShowViewportPanel *)&local_2c);
  }
  else {
    KeyValues::SetInt(this_00,"t1",*(int *)(this + 8));
    KeyValues::SetInt(this_00,"t2",*(int *)(this + 0xc));
    iVar2 = CTerrorGameRules::GetChapterScore(g_pGameRules,1);
    KeyValues::SetInt(this_00,"c1",iVar2);
    iVar2 = CTerrorGameRules::GetChapterScore(g_pGameRules,2);
    KeyValues::SetInt(this_00,"c2",iVar2);
    KeyValues::SetInt(this_00,"tiebreak",iVar6);
    local_3c = 0xffffffff;
    local_38 = "fullscreen_vs_scoreboard";
    local_34 = 1;
    local_30 = this_00;
    ForEachTerrorPlayer<CShowViewportPanel>((CShowViewportPanel *)&local_3c);
    local_2c = 0xffffffff;
    local_28 = "info_window";
    local_24 = 0;
    local_20 = 0;
    ForEachTerrorPlayer<CShowViewportPanel>((CShowViewportPanel *)&local_2c);
    KeyValues::deleteThis();
  }
  UpdateCampaignScores(this);
  CDirector::EndScenario(TheDirector,5);
  iVar6 = TheDirector;
  this[4] = (CDirectorVersusMode)0x0;
  if (((*(char *)(iVar6 + 0x4e5) != '\0') &&
      (cVar1 = CTerrorGameRules::IsMissionFinalMap(), cVar1 != '\0')) &&
     (piVar3 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                (gameeventmanager,"versus_match_finished",1,0), piVar3 != (int *)0x0
     )) {
    cVar1 = '\x01';
    if (*(int *)(this + 8) <= *(int *)(this + 0xc)) {
      cVar1 = (*(int *)(this + 8) < *(int *)(this + 0xc)) * '\x02';
    }
    (**(code **)(*piVar3 + 0x30))(piVar3,"winners",cVar1);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar3,0);
    return;
  }
  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)