L L4D2node

CTerrorPlayer::OnRevived

0x009c3670 · 2989 bytes · __thiscall

_ZN13CTerrorPlayer9OnRevivedEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::OnRevived() */

void __thiscall CTerrorPlayer::OnRevived(CTerrorPlayer *this)

{
  uint uVar1;
  CBaseEdict *pCVar2;
  code *pcVar3;
  bool bVar4;
  undefined1 uVar5;
  char cVar6;
  int iVar7;
  int *piVar8;
  undefined4 uVar9;
  char *pcVar10;
  CBaseEntity *pCVar11;
  undefined *puVar12;
  int iVar13;
  CTerrorPlayer *pCVar14;
  int iVar15;
  CTerrorPlayer *this_00;
  longdouble lVar16;
  TerrorNavArea *pTVar17;
  CAI_Concept local_44 [8];
  AI_CriteriaSet local_3c [44];
  
  cVar6 = (**(code **)(*(int *)this + 300))(this);
  if ((((cVar6 == '\0') ||
       ((((uVar1 = *(uint *)(this + 0x3e68), uVar1 != 0xffffffff &&
          (puVar12 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar12 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar12 + 4) != 0)))) ||
      ((((uVar1 = *(uint *)(this + 0x3e48), uVar1 != 0xffffffff &&
         (puVar12 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar12 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar12 + 4) != 0)))) ||
     ((((uVar1 = *(uint *)(this + 0x33c4), uVar1 != 0xffffffff &&
        (puVar12 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar12 + 8) == uVar1 >> 0xc &&
        ((*(int *)(puVar12 + 4) != 0 && (this[0x39f1] == (CTerrorPlayer)0x0)))))) ||
      (cVar6 = (**(code **)(*(int *)this + 0x7e8))(this), cVar6 == '\0')))) {
    return;
  }
  if (this[0x39f1] == (CTerrorPlayer)0x0) {
    bVar4 = false;
  }
  else {
    uVar1 = *(uint *)(this + 0x2e24);
    if (((((uVar1 == 0xffffffff) ||
          (puVar12 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
         (*(uint *)(puVar12 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar12 + 4) == 0)) &&
       (this[0x3a2c] != (CTerrorPlayer)0x0)) {
      (**(code **)(*(int *)(this + 0x3ab4) + 0x128))(this + 0x3ab4);
      bVar4 = true;
    }
    else {
      (**(code **)(*(int *)(this + 0x3ab4) + 0x120))(this + 0x3ab4);
      bVar4 = false;
    }
  }
  pCVar14 = this + 0x3ab4;
  uVar1 = *(uint *)(this + 0x2e24);
  this_00 = this;
  if (((uVar1 != 0xffffffff) &&
      (puVar12 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
     ((*(uint *)(puVar12 + 8) == uVar1 >> 0xc &&
      (this_00 = (CTerrorPlayer *)*(CCSPlayer **)(puVar12 + 4),
      *(CCSPlayer **)(puVar12 + 4) == (CCSPlayer *)0x0)))) {
    this_00 = this;
  }
  iVar13 = *(int *)(this_00 + 0x3940);
  if (*(CCSPlayer *)(this_00 + 0x6c) == (CCSPlayer)0x0) {
    pCVar2 = *(CBaseEdict **)(this_00 + 0x30);
    if (pCVar2 != (CBaseEdict *)0x0) {
      *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
      iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
      *(undefined2 *)(iVar7 + 2) = 0;
    }
  }
  else {
    *(CCSPlayer *)(this_00 + 0x70) = (CCSPlayer)((byte)*(CCSPlayer *)(this_00 + 0x70) | 1);
  }
  *(int *)(this_00 + 0x3940) = iVar13 + 1;
  if (0.0 < *(float *)(this + 0x3e3c)) {
    lVar16 = (longdouble)CountdownTimer::Now();
    if (*(float *)(this + 0x3e3c) <= (float)lVar16) {
      if (*(float *)(this + 0x3e3c) != -1.0) {
        (**(code **)(*(int *)(this + 0x3e34) + 4))(this + 0x3e34,this + 0x3e3c);
        *(undefined4 *)(this + 0x3e3c) = 0xbf800000;
      }
      (**(code **)(*(int *)(this + 0x3ab4) + 0x138))(pCVar14);
      goto LAB_009c37d6;
    }
    if (this[0x3e40] != (CTerrorPlayer)0x0) goto LAB_009c37e3;
LAB_009c3c8f:
    (**(code **)(*(int *)(this + 0x3ab4) + 0x130))(pCVar14);
  }
  else {
LAB_009c37d6:
    if (this[0x3e40] == (CTerrorPlayer)0x0) goto LAB_009c3c8f;
LAB_009c37e3:
    this[0x3e40] = (CTerrorPlayer)0x0;
    (**(code **)(*(int *)(this + 0x3ab4) + 0x140))(pCVar14);
  }
  iVar13 = *(int *)(this + 0x100);
  if (this[0x2d94] != (CTerrorPlayer)0x0) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar7 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    this[0x2d94] = (CTerrorPlayer)0x0;
  }
  *(undefined4 *)(this + 0x2da8) = 0xffffffff;
  if (*(float *)(this + 0x2db0) != -1.0) {
    (**(code **)(*(int *)(this + 0x2dac) + 4))(this + 0x2dac,this + 0x2db0);
    *(undefined4 *)(this + 0x2db0) = 0xbf800000;
  }
  if (this[0x32fc] != (CTerrorPlayer)0x1) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar7 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    this[0x32fc] = (CTerrorPlayer)0x1;
  }
  if (*(int *)(this + 0x100) != 1) {
    (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
    *(undefined4 *)(this + 0x100) = 1;
  }
  iVar7 = 1;
  if (0 < *(int *)(survivor_revive_health._28_4_ + 0x30)) {
    iVar7 = *(int *)(survivor_revive_health._28_4_ + 0x30);
  }
  SetHealthBuffer(this,(float)iVar7);
  if (this[0x39f1] == (CTerrorPlayer)0x0) {
    iVar7 = *(int *)(this + 0x2e54);
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar15 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar15 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x2e5c) = *(int *)(this + 0x2e5c) + 1;
    *(int *)(this + 0x2e54) = iVar7 + 1;
    cVar6 = IsOnThirdStrike(this);
    if (cVar6 == '\0') goto LAB_009c38c0;
    if (this[0x2e58] != (CTerrorPlayer)0x1) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar7 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x2e58] = (CTerrorPlayer)0x1;
    }
    CCSPlayer::EmitPrivateSound((CCSPlayer *)this,"Player.Heartbeat");
    TrackSound(this,"Player.Heartbeat");
    uVar5 = 1;
  }
  else {
LAB_009c38c0:
    uVar5 = 0;
  }
  if (bVar4) {
    piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                              (gameeventmanager,"player_ledge_release",0,0);
    if (piVar8 != (int *)0x0) {
      pcVar3 = *(code **)(*piVar8 + 0x30);
      uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
      (*pcVar3)(piVar8,"userid",uVar9);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar8,0);
    }
  }
  else {
    piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"revive_success");
    if (piVar8 != (int *)0x0) {
      pcVar3 = *(code **)(*piVar8 + 0x30);
      uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
      (*pcVar3)(piVar8,"userid",uVar9);
      pcVar3 = *(code **)(*piVar8 + 0x30);
      uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
      (*pcVar3)(piVar8,"subject",uVar9);
      (**(code **)(*piVar8 + 0x2c))(piVar8,"ledge_hang",this[0x39f1]);
      (**(code **)(*piVar8 + 0x2c))(piVar8,"lastlife",uVar5);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar8,0);
    }
    AI_CriteriaSet::AI_CriteriaSet(local_3c);
                    /* try { // try from 009c39bd to 009c3a56 has its CatchHandler @ 009c42c1 */
    pcVar10 = (char *)SurvivorCharacterName(*(undefined4 *)(this_00 + 0x2ba0));
    AI_CriteriaSet::AppendCriteria(local_3c,"Subject",pcVar10,1.0);
    pcVar10 = "Ledge";
    if (this[0x39f1] == (CTerrorPlayer)0x0) {
      pcVar10 = "Incap";
    }
    AI_CriteriaSet::AppendCriteria(local_3c,"ReviveType",pcVar10,1.0);
    pcVar3 = *(code **)(*(int *)this + 0x7ac);
    CAI_Concept::CAI_Concept(local_44,"RevivedByFriend");
    (*pcVar3)(this,local_44,local_3c,0,0,0);
    AI_CriteriaSet::~AI_CriteriaSet(local_3c);
  }
  CCSPlayer::SetProgressBarTime((CCSPlayer *)this_00,0.0);
  StopBeingRevived(this,false);
  iVar7 = *(int *)(this + 0x39ec);
  iVar15 = *(int *)(this + 0x39e8) + iVar7;
  if ((iVar15 < 2) ||
     (iVar13 = (int)(((float)iVar13 / *(float *)(SurvivorIncapacitatedHealth._28_4_ + 0x2c)) *
                    (float)iVar15), iVar13 < 2)) goto LAB_009c3b1f;
  iVar15 = iVar15 - iVar13;
  if (iVar15 < iVar7) {
    SetHealthBuffer(this,(float)(iVar7 - iVar15));
    iVar13 = *(int *)(this + 0x39e8);
    if (iVar13 != *(int *)(this + 0x100)) {
LAB_009c3ae3:
      (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
      *(int *)(this + 0x100) = iVar13;
    }
  }
  else {
    SetHealthBuffer(this,0.0);
    iVar13 = (*(int *)(this + 0x39e8) + *(int *)(this + 0x39ec)) - iVar15;
    if (iVar13 != *(int *)(this + 0x100)) goto LAB_009c3ae3;
  }
  if (this[0x32fc] != (CTerrorPlayer)0x0) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar13 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar13 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    this[0x32fc] = (CTerrorPlayer)0x0;
  }
  (**(code **)(*(int *)this + 0x8b4))(this,"world",iVar15);
LAB_009c3b1f:
  if (this[0x39f1] == (CTerrorPlayer)0x0) {
    lVar16 = (longdouble)CountdownTimer::Now();
    if ((float)lVar16 + 2.0 != *(float *)(this + 0x2e68)) {
      (**(code **)(*(int *)(this + 0x2e60) + 4))(this + 0x2e60,this + 0x2e68);
      *(float *)(this + 0x2e68) = (float)lVar16 + 2.0;
    }
    if (*(float *)(this + 0x2e64) != 2.0) {
      (**(code **)(*(int *)(this + 0x2e60) + 4))(this + 0x2e60,this + 0x2e64);
      *(undefined4 *)(this + 0x2e64) = 0x40000000;
    }
  }
  else {
    if (bVar4) {
      CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)(this + 0x3a30));
    }
    else {
      uVar9 = *(undefined4 *)(this + 0x3a64);
      pTVar17 = (TerrorNavArea *)(this + 0x3a14);
      FindSafeStandingPosition((CTerrorPlayer *)local_3c,(Vector *)this,pTVar17);
      CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)local_3c);
      lVar16 = (longdouble)CountdownTimer::Now();
      if ((float)lVar16 + 2.0 != *(float *)(this + 0x2e74)) {
        (**(code **)(*(int *)(this + 0x2e6c) + 4))(this + 0x2e6c,this + 0x2e74,pTVar17,uVar9);
        *(float *)(this + 0x2e74) = (float)lVar16 + 2.0;
      }
      if (*(float *)(this + 0x2e70) != 2.0) {
        (**(code **)(*(int *)(this + 0x2e6c) + 4))(this + 0x2e6c,this + 0x2e70);
        *(undefined4 *)(this + 0x2e70) = 0x40000000;
      }
    }
    if (this[0x39f1] != (CTerrorPlayer)0x0) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar13 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar13 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x39f1] = (CTerrorPlayer)0x0;
    }
    ResetLightingOrigin(this);
    if (this[0x39f2] != (CTerrorPlayer)0x0) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar13 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar13 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x39f2] = (CTerrorPlayer)0x0;
    }
    this[0x3a2c] = (CTerrorPlayer)0x0;
    CBaseEntity::SetMoveType((CBaseEntity *)this,2,0);
  }
  uVar1 = *(uint *)(this + 0x3fa0);
  if ((((uVar1 != 0xffffffff) &&
       (puVar12 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar12 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar12 + 4) != 0)) {
    pCVar11 = (CBaseEntity *)(**(code **)(*(int *)this + 0x484))(this,1);
    if (pCVar11 != (CBaseEntity *)0x0) {
      CBaseCombatCharacter::Weapon_Detach((CBaseCombatCharacter *)this,(CBaseCombatWeapon *)pCVar11)
      ;
      UTIL_Remove(pCVar11);
    }
    uVar1 = *(uint *)(this + 0x3fa0);
    if (((uVar1 != 0xffffffff) &&
        (puVar12 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar12 + 8) == uVar1 >> 0xc && (*(int *)(puVar12 + 4) != 0)))) {
      (**(code **)(*(int *)this + 0x6ac))(this,*(int *)(puVar12 + 4));
      *(undefined4 *)(this + 0x3fa0) = 0xffffffff;
    }
  }
  piVar8 = (int *)(**(code **)(*(int *)this + 0x484))(this,0);
  if ((piVar8 == (int *)0x0) || (cVar6 = (**(code **)(*piVar8 + 0x3c8))(piVar8), cVar6 == '\0')) {
    iVar13 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
    if (iVar13 != 0) {
      piVar8 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
      (**(code **)(*piVar8 + 0x424))(piVar8);
    }
  }
  else {
    (**(code **)(*(int *)this + 0x474))(this,piVar8,0);
  }
  (**(code **)(*(int *)this + 0x7fc))(this,0x31,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)