L L4D2node

CL4DGameStats::Event_LevelInit

0x008deb00 · 812 bytes · __thiscall

_ZN13CL4DGameStats15Event_LevelInitEv

Decompiled

undefined (1 param)

/* CL4DGameStats::Event_LevelInit() */

void __thiscall CL4DGameStats::Event_LevelInit(CL4DGameStats *this)

{
  char cVar1;
  uint uVar2;
  int *piVar3;
  KeyValues *this_00;
  char *pcVar4;
  int iVar5;
  undefined4 uVar6;
  longdouble lVar7;
  
  (**(code **)(*(int *)this + 0x30))(this);
  lVar7 = (longdouble)IntervalTimer::Now();
  if ((float)lVar7 != *(float *)(this + 0x4c8)) {
    (**(code **)(*(int *)(this + 0x4c4) + 4))(this + 0x4c4,this + 0x4c8);
    *(float *)(this + 0x4c8) = (float)lVar7;
  }
  iVar5 = gpGlobals;
  *(int *)(this + 0x74) = (int)*(float *)(gpGlobals + 0xc);
  if (this[0x4e8] == (CL4DGameStats)0x0) {
    pcVar4 = "";
    if (*(char **)(iVar5 + 0x3c) != (char *)0x0) {
      pcVar4 = *(char **)(iVar5 + 0x3c);
    }
    V_FileBase(pcVar4,(char *)(this + 0x4e8),0x104);
  }
  if (engine != (int *)0x0) {
    uVar2 = (**(code **)(*engine + 0x1f8))(engine);
    *(uint *)(this + 0x4e4) = uVar2 & 0xff;
  }
  cVar1 = CTerrorGameRules::IsCoopMode();
  if (cVar1 == '\0') {
    cVar1 = CTerrorGameRules::IsVersusMode();
    if (cVar1 == '\0') {
      cVar1 = CTerrorGameRules::IsSurvivalMode();
      if (cVar1 == '\0') {
        cVar1 = CTerrorGameRules::IsScavengeMode();
        if (cVar1 == '\0') {
          cVar1 = CTerrorGameRules::IsRealismMode();
          if (cVar1 != '\0') {
            *(undefined4 *)(this + 0x4cc) = 4;
          }
        }
        else {
          *(undefined4 *)(this + 0x4cc) = 3;
        }
      }
      else {
        *(undefined4 *)(this + 0x4cc) = 2;
      }
    }
    else {
      *(undefined4 *)(this + 0x4cc) = 1;
    }
  }
  else {
    *(undefined4 *)(this + 0x4cc) = 5;
    if (g_pMatchFramework != (int *)0x0) {
      piVar3 = (int *)(**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework);
      if (piVar3 == (int *)0x0) {
        if ((engine != (int *)0x0) &&
           ((cVar1 = (**(code **)(*engine + 0x1f8))(engine), cVar1 != '\0' ||
            (cVar1 = (**(code **)(*engine + 8))(engine), cVar1 != '\0')))) goto LAB_008deda4;
      }
      else {
        this_00 = (KeyValues *)(**(code **)(*piVar3 + 4))(piVar3);
        pcVar4 = (char *)KeyValues::GetString(this_00,"system/network","");
        iVar5 = _V_stricmp(pcVar4,"LIVE");
        if (iVar5 == 0) {
LAB_008deda4:
          *(undefined4 *)(this + 0x4cc) = 0;
        }
      }
    }
  }
  if ((mp_gamemode[0x15] & 0x10) == 0) {
    pcVar4 = *(char **)(mp_gamemode._28_4_ + 0x24);
    if (pcVar4 == (char *)0x0) {
      pcVar4 = "";
      goto LAB_008dec65;
    }
    if (pcVar4 != "mutation12") goto LAB_008dec65;
  }
  else {
    pcVar4 = "FCVAR_NEVER_AS_STRING";
LAB_008dec65:
    iVar5 = _V_stricmp("mutation12",pcVar4);
    if (iVar5 != 0) {
      if (((((pcVar4 == "coop") || (iVar5 = _V_stricmp("coop",pcVar4), iVar5 == 0)) ||
           (pcVar4 == "realism")) ||
          ((((iVar5 = _V_stricmp("realism",pcVar4), iVar5 == 0 || (pcVar4 == "survival")) ||
            ((iVar5 = _V_stricmp("survival",pcVar4), iVar5 == 0 ||
             ((pcVar4 == "versus" || (iVar5 = _V_stricmp("versus",pcVar4), iVar5 == 0)))))) ||
           (pcVar4 == "teamversus")))) ||
         ((((iVar5 = _V_stricmp("teamversus",pcVar4), iVar5 == 0 || (pcVar4 == "scavenge")) ||
           (iVar5 = _V_stricmp("scavenge",pcVar4), iVar5 == 0)) ||
          ((pcVar4 == "teamscavenge" || (iVar5 = _V_stricmp("teamscavenge",pcVar4), iVar5 == 0))))))
      {
        *(undefined4 *)(this + 0x3f0) = *(undefined4 *)(this + 0x4cc);
        return;
      }
      *(undefined4 *)(this + 0x4cc) = 6;
      uVar6 = 6;
      goto LAB_008dec50;
    }
  }
  *(undefined4 *)(this + 0x4cc) = 7;
  uVar6 = 7;
LAB_008dec50:
  *(undefined4 *)(this + 0x3f0) = uVar6;
  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)