L L4D2node

CCommentarySystem::LevelShutdownPreEntity

0x0064d3e0 · 558 bytes · __thiscall

_ZN17CCommentarySystem22LevelShutdownPreEntityEv

Decompiled

undefined (1 param)

/* CCommentarySystem::LevelShutdownPreEntity() */

void __thiscall CCommentarySystem::LevelShutdownPreEntity(CCommentarySystem *this)

{
  uint uVar1;
  char cVar2;
  CBaseEntity *pCVar3;
  int *piVar4;
  undefined *puVar5;
  int iVar6;
  int iVar7;
  bool bVar8;
  int *local_24 [5];
  
  uVar1 = *(uint *)(this + 0x5c);
  if ((((uVar1 != 0xffffffff) &&
       (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar5 + 8) == uVar1 >> 0xc)) &&
     (*(CPointCommentaryNode **)(puVar5 + 4) != (CPointCommentaryNode *)0x0)) {
    CPointCommentaryNode::AbortPlaying(*(CPointCommentaryNode **)(puVar5 + 4));
  }
  iVar7 = *(int *)(this + 0x50) + -1;
  iVar6 = iVar7 * 4;
  if (-1 < iVar7) {
    do {
      while (((uVar1 = *(uint *)(*(int *)(this + 0x44) + iVar6), uVar1 != 0xffffffff &&
              (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc))
             && ((*(uint *)(puVar5 + 8) == uVar1 >> 0xc &&
                 (*(CBaseEntity **)(puVar5 + 4) != (CBaseEntity *)0x0))))) {
        iVar7 = iVar7 + -1;
        iVar6 = iVar6 + -4;
        UTIL_Remove(*(CBaseEntity **)(puVar5 + 4));
        if (iVar7 == -1) goto LAB_0064d482;
      }
      iVar7 = iVar7 + -1;
      iVar6 = iVar6 + -4;
    } while (iVar7 != -1);
  }
LAB_0064d482:
  *(undefined4 *)(this + 0x50) = 0;
  CUtlMemory<CHandle<CBaseEntity>,int>::Purge((CUtlMemory<CHandle<CBaseEntity>,int> *)(this + 0x44))
  ;
  *(undefined4 *)(this + 0x10) = 0;
  *(undefined4 *)(this + 0x54) = *(undefined4 *)(this + 0x44);
  pCVar3 = (CBaseEntity *)
           CGlobalEntityList::FindEntityByName
                     ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,"commentary_semaphore",
                      (CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
                      (IEntityFindFilter *)0x0);
  if (pCVar3 != (CBaseEntity *)0x0) {
    UTIL_Remove(pCVar3);
  }
  iVar7 = 0;
  (**(code **)(*cvar + 0x44))(cvar,CV_GlobalChange_Commentary);
  if (0 < *(int *)(this + 0x3c)) {
    iVar6 = 0;
    do {
      piVar4 = (int *)(**(code **)(*cvar + 0x30))(cvar,*(int *)(this + 0x30) + iVar6);
      if (piVar4 != (int *)0x0) {
        (**(code **)(*piVar4 + 0x3c))(piVar4,*(int *)(this + 0x30) + iVar6 + 0x100);
      }
      iVar7 = iVar7 + 1;
      iVar6 = iVar6 + 0x180;
    } while (iVar7 < *(int *)(this + 0x3c));
  }
  *(undefined4 *)(this + 0x3c) = 0;
  CUtlMemory<modifiedconvars_t,int>::Purge((CUtlMemory<modifiedconvars_t,int> *)(this + 0x30));
  *(undefined4 *)(this + 0x40) = *(undefined4 *)(this + 0x30);
  if (*(int *)(this + 0x2c) != 0) {
    KeyValues::deleteThis();
  }
  bVar8 = g_bInCommentaryMode != '\0';
  *(undefined4 *)(this + 0x2c) = 0;
  *(undefined4 *)(this + 0x58) = 0xffffffff;
  *(undefined4 *)(this + 0x5c) = 0xffffffff;
  *(undefined4 *)(this + 0x60) = 0xffffffff;
  *(undefined4 *)(this + 0x20) = 0;
  *(undefined4 *)(this + 0x24) = 0;
  if (bVar8) {
    ConVarRef::ConVarRef((ConVarRef *)local_24,"sv_cheats");
    cVar2 = ConVarRef::IsValid((ConVarRef *)local_24);
    if (cVar2 != '\0') {
      (**(code **)(*local_24[0] + 8))(local_24[0],this[0x28]);
      g_bInCommentaryMode = 0;
      return;
    }
  }
  g_bInCommentaryMode = 0;
  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)