L L4D2node

CTerrorPlayer::OnIncapacitatedAsSurvivor

0x009b5fa0 · 3326 bytes · __thiscall

_ZN13CTerrorPlayer25OnIncapacitatedAsSurvivorERK15CTakeDamageInfo

Decompiled

undefined (2 params)

/* CTerrorPlayer::OnIncapacitatedAsSurvivor(CTakeDamageInfo const&) */

void __thiscall
CTerrorPlayer::OnIncapacitatedAsSurvivor(CTerrorPlayer *this,CTakeDamageInfo *param_1)

{
  uint uVar1;
  CBaseEdict *this_00;
  code *pcVar2;
  bool bVar3;
  char cVar4;
  int iVar5;
  int *piVar6;
  undefined4 *puVar7;
  undefined4 uVar8;
  char *pcVar9;
  int *piVar10;
  undefined *puVar11;
  CBaseEntity *pCVar12;
  int in_GS_OFFSET;
  byte bVar13;
  longdouble lVar14;
  float fVar15;
  CDirectorChallengeMode *this_01;
  CDirectorChallengeMode *pCVar16;
  CTerrorPlayer *pCVar17;
  CBaseEntity *local_144;
  CTerrorPlayer *local_138;
  CTerrorPlayer *local_134;
  int *local_130;
  undefined4 local_12c;
  undefined4 local_128;
  undefined1 local_124;
  char local_120 [4];
  undefined4 local_11c [63];
  int local_20;
  
  bVar13 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)(mp_logdetail._28_4_ + 0x30) == 3) {
    LogDamage(this,param_1,1);
  }
  MakeIncapacitatedEventFromInfo(this,param_1,true);
  if (this[0x39f1] == (CTerrorPlayer)0x0) {
    *(undefined4 *)(this + 0x39e8) = 0;
    *(undefined4 *)(this + 0x39ec) = 0;
  }
  else {
    *(undefined4 *)(this + 0x39e8) = *(undefined4 *)(this + 0x100);
    lVar14 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this);
    *(int *)(this + 0x39ec) = (int)lVar14;
  }
  CBasePlayer::ClearUseEntity((CBasePlayer *)this);
  SetPushEntity(this,(CBaseEntity *)0x0);
  uVar1 = *(uint *)(this + 0x3ee0);
  if ((((uVar1 == 0xffffffff) ||
       (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar11 + 8) != uVar1 >> 0xc)) ||
     (pCVar17 = *(CTerrorPlayer **)(puVar11 + 4), pCVar17 == (CTerrorPlayer *)0x0)) {
    bVar3 = false;
  }
  else {
    OnRideEnded(pCVar17,(CTerrorPlayer *)0x0);
    uVar1 = *(uint *)(pCVar17 + 0x30bc);
    bVar3 = true;
    if (((uVar1 != 0xffffffff) &&
        (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar11 + 8) == uVar1 >> 0xc &&
        (*(CBaseAbility **)(puVar11 + 4) != (CBaseAbility *)0x0)))) {
      CBaseAbility::StartActivationTimer
                (*(CBaseAbility **)(puVar11 + 4),
                 *(float *)(ZombieLeapIntervalPostIncap._28_4_ + 0x2c),0.0);
    }
  }
  StopRevivingSomeone(this,true);
  if (this[0x2d94] != (CTerrorPlayer)0x1) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      this_00 = *(CBaseEdict **)(this + 0x30);
      if (this_00 != (CBaseEdict *)0x0) {
        *(uint *)this_00 = *(uint *)this_00 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(this_00);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    this[0x2d94] = (CTerrorPlayer)0x1;
  }
  uVar1 = *(uint *)(param_1 + 0x34);
  if (((uVar1 == 0xffffffff) ||
      (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
     ((*(uint *)(puVar11 + 8) != uVar1 >> 0xc ||
      (piVar6 = *(int **)(puVar11 + 4), piVar6 == (int *)0x0)))) {
    *(undefined4 *)(this + 0x2da8) = 0xffffffff;
  }
  else {
    puVar7 = (undefined4 *)(**(code **)(*piVar6 + 0xc))(piVar6);
    *(undefined4 *)(this + 0x2da8) = *puVar7;
  }
  lVar14 = (longdouble)IntervalTimer::Now();
  if ((float)lVar14 != *(float *)(this + 0x2db0)) {
    (**(code **)(*(int *)(this + 0x2dac) + 4))(this + 0x2dac,this + 0x2db0);
    *(float *)(this + 0x2db0) = (float)lVar14;
  }
  IncapLog("%s is incapacitated",this,(CTerrorPlayer *)0x0);
  iVar5 = *(int *)(SurvivorIncapacitatedHealth._28_4_ + 0x30);
  if (iVar5 != *(int *)(this + 0x100)) {
    (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
    *(int *)(this + 0x100) = iVar5;
  }
  lVar14 = (longdouble)CountdownTimer::Now();
  if ((float)lVar14 + 1.0 != *(float *)(this + 0x2da4)) {
    (**(code **)(*(int *)(this + 0x2d9c) + 4))(this + 0x2d9c,this + 0x2da4);
    *(float *)(this + 0x2da4) = (float)lVar14 + 1.0;
  }
  if (*(float *)(this + 0x2da0) != 1.0) {
    (**(code **)(*(int *)(this + 0x2d9c) + 4))(this + 0x2d9c,this + 0x2da0);
    *(undefined4 *)(this + 0x2da0) = 0x3f800000;
  }
  this[0x3a74] = (CTerrorPlayer)0x0;
  CancelStagger(this);
  lVar14 = (longdouble)RandomFloat(0x3f800000,0x40400000);
  fVar15 = (float)lVar14;
  lVar14 = (longdouble)CountdownTimer::Now();
  if ((float)lVar14 + fVar15 != *(float *)(this + 0x3f80)) {
    (**(code **)(*(int *)(this + 0x3f78) + 4))(this + 0x3f78,this + 0x3f80);
    *(float *)(this + 0x3f80) = (float)lVar14 + fVar15;
  }
  if (fVar15 != *(float *)(this + 0x3f7c)) {
    (**(code **)(*(int *)(this + 0x3f78) + 4))(this + 0x3f78,this + 0x3f7c);
    *(float *)(this + 0x3f7c) = fVar15;
  }
  piVar6 = (int *)GetActiveTerrorWeapon(this);
  if (((piVar6 != (int *)0x0) && (iVar5 = (**(code **)(*piVar6 + 0x638))(piVar6), iVar5 != 1)) &&
     (iVar5 = (**(code **)(*piVar6 + 0x638))(piVar6), iVar5 != 0x20)) {
    uVar1 = *(uint *)(param_1 + 0x34);
    if (((uVar1 == 0xffffffff) ||
        (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
       ((*(uint *)(puVar11 + 8) != uVar1 >> 0xc ||
        (piVar10 = *(int **)(puVar11 + 4), piVar10 == (int *)0x0)))) {
      piVar6[0x561] = -1;
    }
    else {
      piVar10 = (int *)(**(code **)(*piVar10 + 0xc))(piVar10);
      piVar6[0x561] = *piVar10;
    }
    (**(code **)(*piVar6 + 0x428))(piVar6,0);
    piVar6[0x561] = -1;
  }
  cVar4 = OwnsWeaponOfType(this,0);
  if (cVar4 == '\0') {
    pCVar12 = (CBaseEntity *)(**(code **)(*(int *)this + 0x484))(this,1);
    if (pCVar12 != (CBaseEntity *)0x0) {
      CBaseCombatCharacter::Weapon_Detach((CBaseCombatCharacter *)this,(CBaseCombatWeapon *)pCVar12)
      ;
      CBaseEntity::AddEffects(pCVar12,0x20);
      puVar7 = (undefined4 *)(**(code **)(*(int *)pCVar12 + 0xc))(pCVar12);
      *(undefined4 *)(this + 0x3fa0) = *puVar7;
    }
    (**(code **)(*(int *)this + 0x6c0))(this,"weapon_pistol",0,1,0);
  }
  (**(code **)(*(int *)this + 0x850))(this,*(undefined4 *)(ZombieNoiseLevelVocalize._28_4_ + 0x2c));
  puVar7 = local_11c;
  for (iVar5 = 0x3f; iVar5 != 0; iVar5 = iVar5 + -1) {
    *puVar7 = 0;
    puVar7 = puVar7 + (uint)bVar13 * -2 + 1;
  }
  local_120[0] = '\0';
  local_120[1] = '\0';
  local_120[2] = '\0';
  local_120[3] = '\0';
  V_strncat(local_120,"PainLevel:Critical",0x100,-1);
  uVar1 = *(uint *)(param_1 + 0x34);
  if (((uVar1 == 0xffffffff) ||
      (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar11 + 8) != uVar1 >> 0xc)) {
    local_144 = (CBaseEntity *)0x0;
  }
  else {
    local_144 = *(CBaseEntity **)(puVar11 + 4);
    if (((local_144 != (CBaseEntity *)0x0) &&
        (cVar4 = (**(code **)(*(int *)local_144 + 0x16c))(local_144), cVar4 != '\0')) &&
       (iVar5 = CBaseEntity::GetTeamNumber(local_144), iVar5 == 3)) {
      iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      cVar4 = IsASurvivorTeam(iVar5);
      if (cVar4 != '\0') {
        cVar4 = (**(code **)(*(int *)local_144 + 0x16c))(local_144);
        pCVar12 = local_144;
        if (cVar4 == '\0') {
          pCVar12 = (CBaseEntity *)0x0;
        }
        V_strncat(local_120,",SubjectIsA:",0x100,-1);
        uVar8 = (**(code **)(*(int *)pCVar12 + 0x544))(pCVar12);
        pcVar9 = (char *)ZombieClassName(uVar8);
        V_strncat(local_120,pcVar9,0x100,-1);
        OnIncapacitatedSurvivor((CTerrorPlayer *)pCVar12,*(undefined4 *)(this + 0x2ba0));
      }
    }
  }
  uVar1 = *(uint *)(param_1 + 0x30);
  if (((uVar1 == 0xffffffff) ||
      (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar11 + 8) != uVar1 >> 0xc)) {
    cVar4 = (**(code **)(*(int *)local_144 + 0x16c))(local_144);
    if (cVar4 != '\0') goto LAB_009b66e8;
  }
  else {
    piVar6 = *(int **)(puVar11 + 4);
    cVar4 = (**(code **)(*(int *)local_144 + 0x16c))(local_144);
    if (cVar4 == '\0') {
      if ((piVar6 != (int *)0x0) && (cVar4 = (**(code **)(*piVar6 + 0x16c))(piVar6), cVar4 != '\0'))
      {
        cVar4 = (**(code **)(*piVar6 + 0x16c))(piVar6);
        local_134 = this;
        local_12c = 0;
        local_130 = (int *)0x0;
        if (cVar4 != '\0') {
          local_130 = piVar6;
        }
        local_124 = 0;
        local_138 = (CTerrorPlayer *)0xd;
        local_128 = 0;
        ForEachTerrorPlayer<HitAnnouncement>((HitAnnouncement *)&local_138);
      }
    }
    else {
LAB_009b66e8:
      (**(code **)(*(int *)local_144 + 0x16c))(local_144);
    }
  }
  uVar1 = *(uint *)(this + 0x150);
  if (((byte)param_1[0x48] & 8) != 0) {
    CBaseEntity::AddFlag((CBaseEntity *)this,0x8000000);
    V_strncat(local_120,",DamageType:DMG_BURN",0x100,-1);
  }
  pcVar2 = *(code **)(*(int *)this + 0x7b4);
  CAI_Concept::CAI_Concept((CAI_Concept *)&local_138,"PlayerIncapacitated");
  (*pcVar2)(this,(CAI_Concept *)&local_138,1,local_120,0,0,0);
  if ((uVar1 & 0x8000000) == 0) {
    CBaseEntity::RemoveFlag((CBaseEntity *)this,0x8000000);
  }
  lVar14 = (longdouble)CountdownTimer::Now();
  if ((float)lVar14 + 5.0 != *(float *)(this + 0x30a0)) {
    (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x30a0);
    *(float *)(this + 0x30a0) = (float)lVar14 + 5.0;
  }
  if (*(float *)(this + 0x309c) != 5.0) {
    (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x309c);
    *(undefined4 *)(this + 0x309c) = 0x40a00000;
  }
  iVar5 = CBaseEntity::GetTeamNumber(local_144);
  if (iVar5 == 2) {
    if (*(float *)(this + 0x3180) <= 0.0) {
      fVar15 = 99999.9;
    }
    else {
      lVar14 = (longdouble)IntervalTimer::Now();
      fVar15 = (float)lVar14 - *(float *)(this + 0x3180);
    }
    if (fVar15 < *(float *)(SurvivorIntensityRecentEnemyDuration._28_4_ + 0x2c)) goto LAB_009b6806;
  }
  else {
LAB_009b6806:
    if (*(int *)(this + 0x2e54) == 0) {
      Intensity::Increase((Intensity *)(this + 12000),5);
    }
    else {
      Intensity::Increase((Intensity *)(this + 12000),4);
    }
  }
  V_strncat(local_120,",IncapacitatedCharacter:",0x100,-1);
  pcVar9 = (char *)SurvivorCharacterName(*(undefined4 *)(this + 0x2ba0));
  V_strncat(local_120,pcVar9,0x100,-1);
  local_134 = (CTerrorPlayer *)0xd13237;
  local_138 = this;
  local_130 = (int *)local_120;
  ForEachTerrorPlayer<DispatchResponseToSurvivorsWithVisibility>
            ((DispatchResponseToSurvivorsWithVisibility *)&local_138);
  (**(code **)(*(int *)(this + 0x3ab4) + 300))(this + 0x3ab4);
  MakeIncapacitatedEventFromInfo(this,param_1,false);
  this_01 = *(CDirectorChallengeMode **)(TheDirector + 0x648);
  cVar4 = CDirectorChallengeMode::AutoReviveFromSpecialIncap(this_01);
  if (cVar4 != '\0') {
    uVar1 = *(uint *)(this + 0x3e68);
    if ((((uVar1 != 0xffffffff) &&
         (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) &&
       (pCVar17 = *(CTerrorPlayer **)(puVar11 + 4), pCVar17 != (CTerrorPlayer *)0x0)) {
      OnPounceEnded(pCVar17);
      bVar3 = true;
      this_01 = (CDirectorChallengeMode *)pCVar17;
    }
    uVar1 = *(uint *)(this + 0x2a4c);
    if (((uVar1 != 0xffffffff) &&
        (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar11 + 8) == uVar1 >> 0xc &&
        (pCVar17 = *(CTerrorPlayer **)(puVar11 + 4), pCVar17 != (CTerrorPlayer *)0x0)))) {
      OnCarryEnded(pCVar17,true,false,false);
      bVar3 = true;
      this_01 = (CDirectorChallengeMode *)pCVar17;
    }
    uVar1 = *(uint *)(this + 0x33c4);
    if (((uVar1 != 0xffffffff) &&
        (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar11 + 8) == uVar1 >> 0xc &&
        (pCVar17 = *(CTerrorPlayer **)(puVar11 + 4), pCVar17 != (CTerrorPlayer *)0x0)))) {
      ReleaseTongueVictim(pCVar17,false);
      bVar3 = true;
      this_01 = (CDirectorChallengeMode *)pCVar17;
    }
    uVar1 = *(uint *)(this + 0x3e48);
    if ((((uVar1 == 0xffffffff) ||
         (puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar11 + 8) != uVar1 >> 0xc)) ||
       (*(CTerrorPlayer **)(puVar11 + 4) == (CTerrorPlayer *)0x0)) {
      if (!bVar3) goto LAB_009b699a;
    }
    else {
      OnPummelEnded(*(CTerrorPlayer **)(puVar11 + 4),true,(CTerrorPlayer *)0x0);
    }
    pCVar16 = (CDirectorChallengeMode *)(this + 0x2db4);
    (**(code **)(*(int *)this + 0x924))(this);
    this_01 = pCVar16;
    lVar14 = (longdouble)CountdownTimer::Now();
    if ((float)lVar14 + 5.0 != *(float *)(this + 0x2dbc)) {
      this_01 = pCVar16;
      (**(code **)(*(int *)(this + 0x2db4) + 4))(pCVar16,this + 0x2dbc);
      *(float *)(this + 0x2dbc) = (float)lVar14 + 5.0;
    }
    if (*(float *)(this + 0x2db8) != 5.0) {
      (**(code **)(*(int *)(this + 0x2db4) + 4))(pCVar16,this + 0x2db8);
      *(undefined4 *)(this + 0x2db8) = 0x40a00000;
      this_01 = pCVar16;
    }
  }
LAB_009b699a:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail(this_01);
  }
  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)