L L4D2node

CTerrorPlayer::EmitSurvivorPainSound

0x009a0c20 · 3019 bytes · __thiscall

_ZN13CTerrorPlayer21EmitSurvivorPainSoundERK15CTakeDamageInfo

Decompiled

undefined (2 params)

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

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

{
  uint uVar1;
  code *pcVar2;
  bool bVar3;
  char cVar4;
  char *pcVar5;
  int iVar6;
  undefined *puVar7;
  undefined4 uVar8;
  CBaseEntity *pCVar9;
  CBaseEntity *this_00;
  undefined4 *puVar10;
  int in_GS_OFFSET;
  longdouble lVar11;
  float fVar12;
  CTerrorPlayer *pCVar13;
  undefined3 local_12c;
  undefined1 uStack_129;
  CTerrorPlayer local_124 [4];
  char local_120 [4];
  undefined4 local_11c [63];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  uVar1 = *(uint *)(param_1 + 0x34);
  if (((uVar1 == 0xffffffff) ||
      (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) {
    puVar10 = local_11c;
    for (iVar6 = 0x3f; iVar6 != 0; iVar6 = iVar6 + -1) {
      *puVar10 = 0;
      puVar10 = puVar10 + 1;
    }
    this_00 = (CBaseEntity *)0x0;
    local_120[0] = '\0';
    local_120[1] = '\0';
    local_120[2] = '\0';
    local_120[3] = '\0';
LAB_009a0c8d:
    if ((*(uint *)(param_1 + 0x48) != 0x100) && ((*(uint *)(param_1 + 0x48) & 8) == 0))
    goto LAB_009a0fd0;
    iVar6 = *(int *)(this + 0x100);
    fVar12 = *(float *)(param_1 + 0x3c);
    cVar4 = CDirectorChallengeMode::TempHealthOnly
                      (*(CDirectorChallengeMode **)(TheDirector + 0x648));
    if (cVar4 == '\0') {
      fVar12 = fVar12 / (float)iVar6;
    }
    else {
      fVar12 = *(float *)(param_1 + 0x3c);
      lVar11 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this);
      fVar12 = fVar12 / (float)lVar11;
    }
    if (fVar12 < 0.2) {
      V_strncat(local_120,"PainLevel:Minor",0x100,-1);
      uVar8 = 2;
    }
    else if (0.5 <= fVar12) {
      V_strncat(local_120,"PainLevel:Critical",0x100,-1);
      uVar8 = 4;
    }
    else {
      V_strncat(local_120,"PainLevel:Major",0x100,-1);
      uVar8 = 3;
    }
    bVar3 = true;
    if (this_00 != (CBaseEntity *)0x0) goto LAB_009a0ea2;
LAB_009a0ec2:
    Intensity::Increase((Intensity *)(this + 12000),uVar8);
  }
  else {
    this_00 = *(CBaseEntity **)(puVar7 + 4);
    local_120[0] = '\0';
    local_120[1] = '\0';
    local_120[2] = '\0';
    local_120[3] = '\0';
    puVar10 = local_11c;
    for (iVar6 = 0x3f; iVar6 != 0; iVar6 = iVar6 + -1) {
      *puVar10 = 0;
      puVar10 = puVar10 + 1;
    }
    if (((this_00 == (CBaseEntity *)0x0) ||
        (iVar6 = (**(code **)(*(int *)this_00 + 0x144))(this_00), iVar6 == 0)) ||
       ((cVar4 = (**(code **)(*(int *)this + 0x7e8))(this), cVar4 != '\0' &&
        (this == (CTerrorPlayer *)this_00)))) goto LAB_009a0c8d;
    uVar1 = *(uint *)(this + 0x2088);
    if ((((uVar1 == 0xffffffff) ||
         (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) ||
       ((*(CTerrorPlayer **)(puVar7 + 4) == this || (*(int *)(puVar7 + 4) == 0)))) {
      _local_12c = CONCAT13((char)(int)*(float *)(ZombieDamageScreenFadeAlpha._28_4_ + 0x2c),0xff);
      UTIL_ScreenFade((CBaseEntity *)this,(color32_s *)&local_12c,
                      *(float *)(ZombieDamageScreenFadeDuration._28_4_ + 0x2c),0.0,1);
    }
    iVar6 = CBaseEntity::GetTeamNumber(this_00);
    if (((iVar6 == 3) && (*(int *)(param_1 + 0x48) != 0x20000)) &&
       (*(int *)(param_1 + 0x48) != 0x100000)) {
      cVar4 = (**(code **)(*(int *)this + 0x7e8))(this);
      if (cVar4 != '\0') {
        lVar11 = (longdouble)CountdownTimer::Now();
        if (*(float *)(this + 0x3e3c) <= (float)lVar11) {
          (**(code **)(*(int *)(this + 0x3ab4) + 0x134))(this + 0x3ab4);
        }
        lVar11 = (longdouble)CountdownTimer::Now();
        if ((float)lVar11 + 3.0 != *(float *)(this + 0x3e3c)) {
          (**(code **)(*(int *)(this + 0x3e34) + 4))(this + 0x3e34,this + 0x3e3c);
          *(float *)(this + 0x3e3c) = (float)lVar11 + 3.0;
        }
        if (*(float *)(this + 0x3e38) != 3.0) {
          (**(code **)(*(int *)(this + 0x3e34) + 4))(this + 0x3e34,this + 0x3e38);
          *(undefined4 *)(this + 0x3e38) = 0x40400000;
        }
      }
      cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
      if ((cVar4 != '\0') &&
         (((((uVar1 = *(uint *)(this + 0x3e68), uVar1 == 0xffffffff ||
             (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc))
            || (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) ||
           (this_00 != *(CBaseEntity **)(puVar7 + 4))) &&
          ((iVar6 = CBaseEntity::GetTeamNumber(this_00), iVar6 != 3 ||
           (iVar6 = (**(code **)(*(int *)this_00 + 0x544))(this_00), iVar6 != 6)))))) {
        CBaseEntity::EmitSound((CBaseEntity *)this,"PlayerZombie.AttackHit",0.0,(float *)0x0);
      }
    }
    cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
    if ((cVar4 == '\0') || (*(int *)(param_1 + 0x48) != 0x80)) {
LAB_009a0e5f:
      cVar4 = (**(code **)(*(int *)this + 0x7e8))(this);
      if (cVar4 == '\0') {
        iVar6 = *(int *)(this + 0x100);
        fVar12 = *(float *)(param_1 + 0x3c);
        cVar4 = CDirectorChallengeMode::TempHealthOnly
                          (*(CDirectorChallengeMode **)(TheDirector + 0x648));
        if (cVar4 == '\0') {
          fVar12 = fVar12 / (float)iVar6;
        }
        else {
          fVar12 = *(float *)(param_1 + 0x3c);
          lVar11 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this);
          fVar12 = fVar12 / (float)lVar11;
        }
        if (fVar12 < 0.2) {
          bVar3 = true;
          V_strncat(local_120,"PainLevel:Minor",0x100,-1);
          uVar8 = 2;
        }
        else {
          if (fVar12 < 0.5) {
            pcVar5 = "PainLevel:Major";
            goto LAB_009a0e8a;
          }
          bVar3 = true;
          V_strncat(local_120,"PainLevel:Critical",0x100,-1);
          uVar8 = 4;
        }
      }
      else {
        pcVar5 = "PainLevel:Incapacitated";
LAB_009a0e8a:
        bVar3 = true;
        V_strncat(local_120,pcVar5,0x100,-1);
        uVar8 = 3;
      }
    }
    else {
      cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
      pCVar9 = (CBaseEntity *)0x0;
      if (cVar4 != '\0') {
        pCVar9 = this_00;
      }
      iVar6 = CBaseEntity::GetTeamNumber(pCVar9);
      if ((((iVar6 != 3) || (iVar6 = (**(code **)(*(int *)pCVar9 + 0x544))(pCVar9), iVar6 != 3)) ||
          (uVar1 = *(uint *)(this + 0x3e68), uVar1 == 0xffffffff)) ||
         (((puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc ||
           (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) || (this_00 != *(CBaseEntity **)(puVar7 + 4)))))
      goto LAB_009a0e5f;
      if ((this[0x3e8c] == (CTerrorPlayer)0x0) &&
         (cVar4 = (**(code **)(*(int *)this + 0x7e8))(this), cVar4 != '\0')) {
        lVar11 = (longdouble)CountdownTimer::Now();
        fVar12 = *(float *)(this + 0x30a0);
        if (((float)lVar11 < fVar12) &&
           (lVar11 = (longdouble)CountdownTimer::Now(), 0.5 <= fVar12 - (float)lVar11))
        goto LAB_009a1593;
        bVar3 = true;
        V_strncat(local_120,"PainLevel:Incapacitated",0x100,-1);
        uVar8 = 2;
        this[0x3e8c] = (CTerrorPlayer)((byte)this[0x3e8c] ^ 1);
      }
      else {
        lVar11 = (longdouble)CountdownTimer::Now();
        fVar12 = *(float *)(this + 0x30a0);
        if ((fVar12 <= (float)lVar11) ||
           (lVar11 = (longdouble)CountdownTimer::Now(), fVar12 - (float)lVar11 < 0.5)) {
          if (*(int *)(developer._28_4_ + 0x30) != 0) {
            pCVar13 = this;
            GetClientColor(local_124);
            uVar8 = (**(code **)(*(int *)this + 0xb8))(this,pCVar13);
            ConColorMsg(local_124,"%3.1f: %s Say( Player.ScreamWhilePounced )\n",
                        (double)*(float *)(gpGlobals + 0xc),uVar8);
          }
          pcVar2 = *(code **)(*(int *)this + 0x7b4);
          CAI_Concept::CAI_Concept((CAI_Concept *)&local_12c,"ScreamWhilePounced");
          (*pcVar2)(this,(CAI_Concept *)&local_12c,1,0,0,0,0);
          lVar11 = (longdouble)CountdownTimer::Now();
          if ((float)lVar11 + 2.0 != *(float *)(this + 0x30a0)) {
            (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x30a0);
            *(float *)(this + 0x30a0) = (float)lVar11 + 2.0;
          }
          if (*(float *)(this + 0x309c) != 2.0) {
            (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x309c);
            *(undefined4 *)(this + 0x309c) = 0x40000000;
          }
          this[0x3e8c] = (CTerrorPlayer)((byte)this[0x3e8c] ^ 1);
          bVar3 = false;
          uVar8 = 2;
        }
        else {
LAB_009a1593:
          bVar3 = false;
          uVar8 = 2;
        }
      }
    }
LAB_009a0ea2:
    iVar6 = CBaseEntity::GetTeamNumber(this_00);
    cVar4 = IsASurvivorTeam(iVar6);
    if (cVar4 == '\0') goto LAB_009a0ec2;
  }
  if (bVar3) {
    lVar11 = (longdouble)CountdownTimer::Now();
    if (*(float *)(this + 0x334c) <= (float)lVar11) {
      if (this_00 != (CBaseEntity *)0x0) {
        cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
        if ((cVar4 != '\0') && (iVar6 = CBaseEntity::GetTeamNumber(this_00), iVar6 == 3)) {
          cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
          pCVar9 = (CBaseEntity *)0x0;
          if (cVar4 != '\0') {
            pCVar9 = this_00;
          }
          V_strncat(local_120,",SubjectIsA:",0x100,-1);
          uVar8 = (**(code **)(*(int *)pCVar9 + 0x544))(pCVar9);
          pcVar5 = (char *)ZombieClassName(uVar8);
          V_strncat(local_120,pcVar5,0x100,-1);
        }
      }
      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_12c,"Pain");
      cVar4 = (*pcVar2)(this,(CAI_Concept *)&local_12c,1,local_120,0,0,0);
      if (cVar4 != '\0') {
        lVar11 = (longdouble)CountdownTimer::Now();
        if ((float)lVar11 + 1.5 != *(float *)(this + 0x334c)) {
          (**(code **)(*(int *)(this + 0x3344) + 4))(this + 0x3344,this + 0x334c);
          *(float *)(this + 0x334c) = (float)lVar11 + 1.5;
        }
        if (*(float *)(this + 0x3348) != 1.5) {
          (**(code **)(*(int *)(this + 0x3344) + 4))(this + 0x3344,this + 0x3348);
          *(undefined4 *)(this + 0x3348) = 0x3fc00000;
        }
      }
      if ((uVar1 & 0x8000000) == 0) {
        CBaseEntity::RemoveFlag((CBaseEntity *)this,0x8000000);
      }
    }
  }
LAB_009a0fd0:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)