L L4D2node

CTerrorPlayer::OnPreThinkObserverMode

0x00999070 · 893 bytes · __thiscall

_ZN13CTerrorPlayer22OnPreThinkObserverModeEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::OnPreThinkObserverMode() */

void __thiscall CTerrorPlayer::OnPreThinkObserverMode(CTerrorPlayer *this)

{
  undefined4 uVar1;
  int iVar2;
  CBaseEdict *pCVar3;
  uint uVar4;
  char cVar5;
  int iVar6;
  int iVar7;
  CBaseEntity *pCVar8;
  int *piVar9;
  undefined *puVar10;
  CBaseEntity *this_00;
  int iVar11;
  undefined4 local_30 [3];
  undefined4 local_24;
  undefined4 local_20;
  
  if (((((byte)this[0x1cb6] & 8) != 0) &&
      (iVar11 = CDirectorTacticalServices::GetHighestFlowSurvivor
                          (*(CDirectorTacticalServices **)(TheDirector + 0x628),0), iVar11 != 0)) &&
     (iVar6 = (**(code **)(*(int *)this + 0x654))(this), iVar11 != iVar6)) {
    (**(code **)(*(int *)this + 0x64c))(this,iVar11);
  }
  piVar9 = *(int **)(this + 0x13e0);
  if (piVar9 == (int *)0x0) {
    iVar11 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar11 == 0) {
      piVar9 = *(int **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      piVar9 = *(int **)(this + 0x13e0);
    }
    if (piVar9 == (int *)0x0) goto LAB_009991b7;
  }
  if (*piVar9 != 0) {
    CMultiPlayerAnimState::StopAllGestures(*(CMultiPlayerAnimState **)(this + 0x2910));
    (**(code **)(**(int **)(this + 0x2910) + 0x14))(*(int **)(this + 0x2910));
    (**(code **)**(undefined4 **)(this + 0x2910))(*(undefined4 **)(this + 0x2910));
    if (0 < *(int *)(this + 0x1400)) {
      iVar11 = 0;
      do {
        while( true ) {
          iVar6 = CBaseAnimatingOverlay::GetAnimOverlay((CBaseAnimatingOverlay *)this,iVar11);
          if (*(int *)(iVar6 + 0x3c) != 0xf) {
            iVar2 = *(int *)(iVar6 + 0x48);
            if (iVar2 != 0) {
              if (*(char *)(iVar2 + 0x6c) == '\0') {
                pCVar3 = *(CBaseEdict **)(iVar2 + 0x30);
                if (pCVar3 != (CBaseEdict *)0x0) {
                  *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
                  iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
                  *(undefined2 *)(iVar7 + 2) = 0;
                }
              }
              else {
                *(byte *)(iVar2 + 0x70) = *(byte *)(iVar2 + 0x70) | 1;
              }
              uVar1 = *(undefined4 *)(gpGlobals + 0xc);
              *(undefined4 *)(iVar2 + 0x78) = 0;
              *(undefined4 *)(iVar2 + 0x74) = uVar1;
            }
            *(undefined4 *)(iVar6 + 0x3c) = 0xf;
          }
          if (*(int *)(iVar6 + 8) == 0) break;
          iVar2 = *(int *)(iVar6 + 0x48);
          if (iVar2 != 0) {
            if (*(char *)(iVar2 + 0x6c) == '\0') {
              pCVar3 = *(CBaseEdict **)(iVar2 + 0x30);
              if (pCVar3 != (CBaseEdict *)0x0) {
                *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
                iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
                *(undefined2 *)(iVar7 + 2) = 0;
              }
            }
            else {
              *(byte *)(iVar2 + 0x70) = *(byte *)(iVar2 + 0x70) | 1;
            }
            uVar1 = *(undefined4 *)(gpGlobals + 0xc);
            *(undefined4 *)(iVar2 + 0x78) = 0;
            *(undefined4 *)(iVar2 + 0x74) = uVar1;
          }
          *(undefined4 *)(iVar6 + 8) = 0;
          iVar11 = iVar11 + 1;
          if (*(int *)(this + 0x1400) <= iVar11) goto LAB_009991b7;
        }
        iVar11 = iVar11 + 1;
      } while (iVar11 < *(int *)(this + 0x1400));
    }
  }
LAB_009991b7:
  pCVar8 = (CBaseEntity *)(**(code **)(*(int *)this + 0x654))(this);
  if ((pCVar8 == (CBaseEntity *)0x0) ||
     (cVar5 = (**(code **)(*(int *)pCVar8 + 0x16c))(pCVar8), cVar5 == '\0')) {
    this_00 = (CBaseEntity *)0x0;
  }
  else {
    uVar4 = *(uint *)(pCVar8 + 0x2088);
    if (((uVar4 == 0xffffffff) ||
        (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
       ((*(uint *)(puVar10 + 8) != uVar4 >> 0xc ||
        ((this_00 = *(CBaseEntity **)(puVar10 + 4), pCVar8 == this_00 ||
         (this_00 == (CBaseEntity *)0x0)))))) {
      this_00 = (CBaseEntity *)0x0;
    }
    else if ((*(char **)(this_00 + 0x7c) != "point_deathfall_camera") &&
            (cVar5 = CBaseEntity::ClassMatchesComplex(this_00,"point_deathfall_camera"),
            cVar5 == '\0')) {
      this_00 = (CBaseEntity *)0x0;
    }
  }
  uVar4 = *(uint *)(this + 0x2088);
  if (((((uVar4 == 0xffffffff) ||
        (puVar10 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar10 + 8) != uVar4 >> 0xc)) ||
      ((pCVar8 = *(CBaseEntity **)(puVar10 + 4), pCVar8 == (CBaseEntity *)this ||
       (pCVar8 == (CBaseEntity *)0x0)))) ||
     ((*(char **)(pCVar8 + 0x7c) != "point_deathfall_camera" &&
      (cVar5 = CBaseEntity::ClassMatchesComplex(pCVar8,"point_deathfall_camera"), cVar5 == '\0'))))
  {
    pCVar8 = (CBaseEntity *)0x0;
  }
  if (pCVar8 != this_00) {
    CBasePlayer::ClearZoomOwner((CBasePlayer *)this);
    CBasePlayer::SetFOV((CBasePlayer *)this,(CBaseEntity *)this,0,0.0,0);
    CBasePlayer::SetViewEntity((CBasePlayer *)this,(CBaseEntity *)0x0);
    if (this_00 != (CBaseEntity *)0x0) {
      local_30[0] = 0;
      local_24 = 0xffffffff;
      local_20 = 0;
      (**(code **)(*(int *)this_00 + 0xb4))(this_00,"Enable",this,0,local_30,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)