L L4D2node

CTerrorPlayer::UpdateTonemapController

0x0099af30 · 1624 bytes · __thiscall

_ZN13CTerrorPlayer23UpdateTonemapControllerEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::UpdateTonemapController() */

void __thiscall CTerrorPlayer::UpdateTonemapController(CTerrorPlayer *this)

{
  CBaseEdict *pCVar1;
  char cVar2;
  int iVar3;
  uint *puVar4;
  int iVar5;
  undefined4 *puVar6;
  uint uVar7;
  undefined *puVar8;
  int iVar9;
  int iVar10;
  int *piVar11;
  int *piVar12;
  CBaseEntity *this_00;
  int local_20;
  
  iVar10 = *(int *)(this + 0x1c58) * 4;
  iVar3 = *(int *)(this + 0x1c58) + -1;
  if (-1 < iVar3) {
    do {
      puVar4 = (uint *)(*(int *)(this + 0x1c4c) + iVar10 + -4);
      uVar7 = *puVar4;
      if ((((uVar7 == 0xffffffff) ||
           (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
          (*(uint *)(puVar8 + 8) != uVar7 >> 0xc)) || (*(int *)(puVar8 + 4) == 0)) {
        iVar9 = *(int *)(this + 0x1c58);
        iVar5 = (iVar9 - iVar3) + -1;
        if (0 < iVar5) {
          _V_memmove(puVar4,(void *)(iVar10 + *(int *)(this + 0x1c4c)),iVar5 * 4);
          iVar9 = *(int *)(this + 0x1c58);
        }
        *(int *)(this + 0x1c58) = iVar9 + -1;
      }
      iVar3 = iVar3 + -1;
      iVar10 = iVar10 + -4;
    } while (iVar3 != -1);
  }
  cVar2 = (**(code **)(*(int *)this + 300))(this);
  if ((cVar2 == '\0') && (iVar10 = (**(code **)(*(int *)this + 0x654))(this), iVar10 != 0)) {
    piVar11 = (int *)(**(code **)(*(int *)this + 0x654))(this);
    cVar2 = (**(code **)(*piVar11 + 0x16c))(piVar11);
    if (cVar2 == '\0') goto LAB_0099afdd;
    piVar11 = (int *)(**(code **)(*(int *)this + 0x654))(this);
    if ((piVar11 == (int *)0x0) || (cVar2 = (**(code **)(*piVar11 + 0x16c))(piVar11), cVar2 == '\0')
       ) {
      piVar11 = (int *)0x0;
    }
    uVar7 = piVar11[0x76f];
joined_r0x0099b270:
    if (uVar7 == 0xffffffff) goto LAB_0099b020;
LAB_0099b276:
    puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10;
    if ((puVar8 == (undefined *)0xfffffffc) || (*(uint *)(puVar8 + 8) != uVar7 >> 0xc))
    goto LAB_0099b020;
    piVar11 = *(int **)(puVar8 + 4);
  }
  else {
LAB_0099afdd:
    cVar2 = (**(code **)(*(int *)this + 0x558))(this);
    if (cVar2 == '\0') {
      cVar2 = (**(code **)(*(int *)this + 300))(this);
      if ((cVar2 == '\0') || (iVar10 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar10 != 3)
         ) {
        cVar2 = (**(code **)(*(int *)this + 300))(this);
        if ((cVar2 != '\0') && (iVar10 = 0, 0 < *(int *)(this + 0x1c58))) {
          do {
            local_20 = 0;
            uVar7 = *(uint *)(*(int *)(this + 0x1c4c) + iVar10 * 4);
            if (((uVar7 != 0xffffffff) &&
                (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)
                ) && (*(uint *)(puVar8 + 8) == uVar7 >> 0xc)) {
              local_20 = *(int *)(puVar8 + 4);
            }
            uVar7 = *(uint *)(local_20 + 0x570);
            if ((((uVar7 != 0xffffffff) &&
                 (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc
                 )) && ((*(uint *)(puVar8 + 8) == uVar7 >> 0xc &&
                        (this_00 = *(CBaseEntity **)(puVar8 + 4), this_00 != (CBaseEntity *)0x0))))
               && ((*(char **)(this_00 + 0x7c) == "env_tonemap_controller" ||
                   (cVar2 = CBaseEntity::ClassMatchesComplex(this_00,"env_tonemap_controller"),
                   cVar2 != '\0')))) {
              uVar7 = *(uint *)(this + 0x1dbc);
              if ((uVar7 != 0xffffffff) &&
                 (((puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10,
                   puVar8 != (undefined *)0xfffffffc && (*(uint *)(puVar8 + 8) == uVar7 >> 0xc)) &&
                  (this_00 == *(CBaseEntity **)(puVar8 + 4))))) {
                return;
              }
              goto LAB_0099b1a0;
            }
            iVar10 = iVar10 + 1;
          } while (iVar10 < *(int *)(this + 0x1c58));
        }
        iVar10 = TheTonemapSystem();
        piVar11 = (int *)0x0;
        uVar7 = *(uint *)(iVar10 + 0xc);
        if (((uVar7 != 0xffffffff) &&
            (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
           (*(uint *)(puVar8 + 8) == uVar7 >> 0xc)) {
          piVar11 = *(int **)(puVar8 + 4);
        }
        uVar7 = *(uint *)(this + 0x1dbc);
        piVar12 = (int *)0x0;
        if (((uVar7 != 0xffffffff) &&
            (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
           (*(uint *)(puVar8 + 8) == uVar7 >> 0xc)) {
          piVar12 = *(int **)(puVar8 + 4);
        }
        if (piVar11 == piVar12) {
          return;
        }
        goto LAB_0099b057;
      }
      if (0 < *(int *)(this + 0x1c58)) {
        iVar10 = 0;
        do {
          local_20 = 0;
          uVar7 = *(uint *)(*(int *)(this + 0x1c4c) + iVar10 * 4);
          if (((uVar7 != 0xffffffff) &&
              (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc))
             && (*(uint *)(puVar8 + 8) == uVar7 >> 0xc)) {
            local_20 = *(int *)(puVar8 + 4);
          }
          uVar7 = *(uint *)(local_20 + 0x570);
          if (((uVar7 != 0xffffffff) &&
              (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc))
             && (((*(uint *)(puVar8 + 8) == uVar7 >> 0xc &&
                  (this_00 = *(CBaseEntity **)(puVar8 + 4), this_00 != (CBaseEntity *)0x0)) &&
                 ((*(char **)(this_00 + 0x7c) == "env_tonemap_controller_infected" ||
                  (cVar2 = CBaseEntity::ClassMatchesComplex
                                     (this_00,"env_tonemap_controller_infected"), cVar2 != '\0')))))
             ) {
            uVar7 = *(uint *)(this + 0x1dbc);
            if (uVar7 == 0xffffffff) goto LAB_0099b1a0;
            puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10;
            goto joined_r0x0099b581;
          }
          iVar10 = iVar10 + 1;
        } while (iVar10 < *(int *)(this + 0x1c58));
      }
      iVar10 = TheTonemapSystem();
      uVar7 = *(uint *)(iVar10 + 0x10);
      goto joined_r0x0099b270;
    }
    iVar10 = 0;
    if (0 < *(int *)(this + 0x1c58)) {
      do {
        local_20 = 0;
        uVar7 = *(uint *)(*(int *)(this + 0x1c4c) + iVar10 * 4);
        if (((uVar7 != 0xffffffff) &&
            (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
           (*(uint *)(puVar8 + 8) == uVar7 >> 0xc)) {
          local_20 = *(int *)(puVar8 + 4);
        }
        uVar7 = *(uint *)(local_20 + 0x570);
        if ((((uVar7 != 0xffffffff) &&
             (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc))
            && ((*(uint *)(puVar8 + 8) == uVar7 >> 0xc &&
                (this_00 = *(CBaseEntity **)(puVar8 + 4), this_00 != (CBaseEntity *)0x0)))) &&
           ((*(char **)(this_00 + 0x7c) == "env_tonemap_controller_ghost" ||
            (cVar2 = CBaseEntity::ClassMatchesComplex(this_00,"env_tonemap_controller_ghost"),
            cVar2 != '\0')))) {
          uVar7 = *(uint *)(this + 0x1dbc);
          if (uVar7 != 0xffffffff) {
            puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10;
joined_r0x0099b581:
            if (((puVar8 + 4 != (undefined *)0x0) && (*(uint *)(puVar8 + 4 + 4) == uVar7 >> 0xc)) &&
               (this_00 == *(CBaseEntity **)(puVar8 + 4))) {
              return;
            }
          }
LAB_0099b1a0:
          if (this[0x6c] == (CTerrorPlayer)0x0) {
            pCVar1 = *(CBaseEdict **)(this + 0x30);
            if (pCVar1 != (CBaseEdict *)0x0) {
              *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
              iVar10 = CBaseEdict::GetChangeAccessor(pCVar1);
              *(undefined2 *)(iVar10 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
          }
          puVar6 = (undefined4 *)(**(code **)(*(int *)this_00 + 0xc))(this_00);
          *(undefined4 *)(this + 0x1dbc) = *puVar6;
          return;
        }
        iVar10 = iVar10 + 1;
      } while (iVar10 < *(int *)(this + 0x1c58));
    }
    iVar10 = TheTonemapSystem();
    uVar7 = *(uint *)(iVar10 + 0x14);
    if (uVar7 != 0xffffffff) goto LAB_0099b276;
LAB_0099b020:
    piVar11 = (int *)0x0;
  }
  uVar7 = *(uint *)(this + 0x1dbc);
  piVar12 = (int *)0x0;
  if (((uVar7 != 0xffffffff) &&
      (puVar8 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar8 + 8) == uVar7 >> 0xc)) {
    piVar12 = *(int **)(puVar8 + 4);
  }
  if (piVar11 == piVar12) {
    return;
  }
LAB_0099b057:
  if (this[0x6c] == (CTerrorPlayer)0x0) {
    pCVar1 = *(CBaseEdict **)(this + 0x30);
    if (pCVar1 != (CBaseEdict *)0x0) {
      *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
      iVar10 = CBaseEdict::GetChangeAccessor(pCVar1);
      *(undefined2 *)(iVar10 + 2) = 0;
    }
  }
  else {
    this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
  }
  if (piVar11 != (int *)0x0) {
    puVar6 = (undefined4 *)(**(code **)(*piVar11 + 0xc))(piVar11);
    *(undefined4 *)(this + 0x1dbc) = *puVar6;
    return;
  }
  *(undefined4 *)(this + 0x1dbc) = 0xffffffff;
  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)