L L4D2node

SurvivorIntention::IsDangerousTo

0x0094add0 · 1395 bytes · __thiscall

_ZNK17SurvivorIntention13IsDangerousToEPK13CTerrorPlayerP20CBaseCombatCharacter

Decompiled

undefined (3 params)

/* SurvivorIntention::IsDangerousTo(CTerrorPlayer const*, CBaseCombatCharacter*) const */

char __thiscall
SurvivorIntention::IsDangerousTo
          (SurvivorIntention *this,CTerrorPlayer *param_1,CBaseCombatCharacter *param_2)

{
  CTerrorPlayer *pCVar1;
  uint uVar2;
  CBaseEntity *this_00;
  char cVar3;
  undefined1 uVar4;
  char cVar5;
  undefined4 uVar6;
  int *piVar7;
  int iVar8;
  Infected *this_01;
  undefined *puVar9;
  float fVar10;
  float local_24;
  int local_20;
  
  pCVar1 = *(CTerrorPlayer **)(this + 0x18);
  if ((param_2 == (CBaseCombatCharacter *)0x0) ||
     (cVar3 = (**(code **)(*(int *)param_2 + 300))(param_2), cVar3 == '\0'))
  goto switchD_0094ae10_default;
  uVar6 = CTerrorPlayer::ClassifyZombie((CBaseEntity *)param_2);
  switch(uVar6) {
  case 0:
    piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x148))(param_2);
    if (*(int *)(TheDirector + 0x460) < 1) {
      if (param_1 == (CTerrorPlayer *)0x0) {
        local_24 = -1.0;
      }
      else {
        if (((byte)param_1[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
        }
        if (((byte)param_2[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
        }
        local_24 = SQRT((*(float *)(param_2 + 0x2e4) - *(float *)(param_1 + 0x2e4)) *
                        (*(float *)(param_2 + 0x2e4) - *(float *)(param_1 + 0x2e4)) +
                        (*(float *)(param_2 + 0x2e8) - *(float *)(param_1 + 0x2e8)) *
                        (*(float *)(param_2 + 0x2e8) - *(float *)(param_1 + 0x2e8)) +
                        (*(float *)(param_2 + 0x2e0) - *(float *)(param_1 + 0x2e0)) *
                        (*(float *)(param_2 + 0x2e0) - *(float *)(param_1 + 0x2e0)));
      }
      if (((pCVar1 != param_1) &&
          ((0 < *(int *)(TheDirector + 0x1c0) ||
           (cVar5 = CTerrorPlayer::IsBeingHeroic(*(CTerrorPlayer **)(this + 0x18)), cVar5 != '\0')))
          ) && (local_24 <= 48.0)) {
        cVar5 = (**(code **)(*(int *)param_1 + 0x7e8))(param_1);
        if (cVar5 != '\0') {
          return cVar3;
        }
        cVar5 = CTerrorPlayer::IsDominatedBySpecialInfected(param_1);
        if (cVar5 != '\0') {
          return cVar3;
        }
      }
      iVar8 = (**(code **)(*(int *)param_2 + 0x14c))(param_2);
      if (((*(byte *)(iVar8 + 0x1c74) & 0x20) == 0) ||
         ((((this_01 = (Infected *)(**(code **)(*(int *)param_2 + 0x14c))(param_2),
            this_01 != (Infected *)0x0 && (cVar3 = Infected::IsStumbling(this_01), cVar3 != '\0'))
           || (cVar3 = (**(code **)(*(int *)param_2 + 0x424))(param_2,*(undefined4 *)(this + 0x18)),
              cVar3 == '\0')) || (local_24 <= 48.0)))) {
        if (piVar7 == (int *)0x0) {
LAB_0094b151:
                    /* WARNING: Could not recover jumptable at 0x0094b16d. Too many branches */
                    /* WARNING: Treating indirect jump as call */
          uVar4 = (**(code **)(*(int *)param_1 + 0x42c))();
          return uVar4;
        }
        piVar7 = (int *)(**(code **)(*piVar7 + 0xc4))(piVar7);
        cVar3 = (**(code **)(*piVar7 + 0x114))(piVar7,0);
        if ((cVar3 == '\0') || (local_24 < *(float *)(SurvivorBotThreatMediumRange._28_4_ + 0x2c)))
        goto LAB_0094b151;
        if ((local_24 < *(float *)(SurvivorBotThreatFarRange._28_4_ + 0x2c)) &&
           (0 < *(int *)(this + 0x70))) {
          local_20 = 0;
          iVar8 = 0;
          do {
            uVar2 = *(uint *)(iVar8 * 0x2c + *(int *)(this + 100));
            if (((uVar2 == 0xffffffff) ||
                (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)
                ) || (*(uint *)(puVar9 + 8) != uVar2 >> 0xc)) {
LAB_0094b138:
              local_20 = local_20 + 1;
            }
            else {
              this_00 = *(CBaseEntity **)(puVar9 + 4);
              if (param_2 != (CBaseCombatCharacter *)this_00) {
                if (this_00 != (CBaseEntity *)0x0) {
                  if (((byte)this_00[0x14d] & 8) != 0) {
                    CBaseEntity::CalcAbsolutePosition(this_00);
                  }
                  if (((byte)param_2[0x14d] & 8) != 0) {
                    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
                  }
                  if (250.0 <= SQRT((*(float *)(param_2 + 0x2e4) - *(float *)(this_00 + 0x2e4)) *
                                    (*(float *)(param_2 + 0x2e4) - *(float *)(this_00 + 0x2e4)) +
                                    (*(float *)(param_2 + 0x2e8) - *(float *)(this_00 + 0x2e8)) *
                                    (*(float *)(param_2 + 0x2e8) - *(float *)(this_00 + 0x2e8)) +
                                    (*(float *)(param_2 + 0x2e0) - *(float *)(this_00 + 0x2e0)) *
                                    (*(float *)(param_2 + 0x2e0) - *(float *)(this_00 + 0x2e0))))
                  goto LAB_0094b13c;
                }
                goto LAB_0094b138;
              }
            }
LAB_0094b13c:
            iVar8 = iVar8 + 1;
            if (*(int *)(this + 0x70) <= iVar8) {
              if (local_20 < 3) goto switchD_0094ae10_default;
              break;
            }
          } while (local_20 < 3);
          goto LAB_0094b151;
        }
      }
    }
  default:
switchD_0094ae10_default:
    cVar3 = '\0';
switchD_0094ae10_caseD_8:
    return cVar3;
  case 1:
  case 2:
  case 3:
  case 4:
  case 5:
  case 6:
    cVar3 = IsInCommentaryMode();
    if ((cVar3 == '\0') || (cVar3 = CDirector::IsFinale(TheDirector), cVar3 != '\0'))
    goto switchD_0094ae10_caseD_7;
    cVar3 = (**(code **)(*(int *)param_1 + 0x778))(param_1);
    if ((cVar3 != '\0') ||
       ((((cVar3 = (**(code **)(*(int *)param_1 + 0x7e8))(param_1), cVar3 == '\0' &&
          (cVar3 = (**(code **)(*(int *)param_1 + 0x550))(param_1), cVar3 == '\0')) &&
         ((uVar2 = *(uint *)(param_1 + 0x33c4), uVar2 == 0xffffffff ||
          (((puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc ||
            (*(uint *)(puVar9 + 8) != uVar2 >> 0xc)) || (*(int *)(puVar9 + 4) == 0)))))) &&
        (((uVar2 = *(uint *)(param_1 + 0x3e68), uVar2 == 0xffffffff ||
          (puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
         ((*(uint *)(puVar9 + 8) != uVar2 >> 0xc || (*(int *)(puVar9 + 4) == 0))))))))
    goto switchD_0094ae10_default;
    break;
  case 7:
switchD_0094ae10_caseD_7:
    if (param_1 == (CTerrorPlayer *)0x0) {
      fVar10 = -1.0;
      goto LAB_0094aee2;
    }
    break;
  case 8:
    goto switchD_0094ae10_caseD_8;
  }
  if (((byte)param_1[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  if (((byte)param_2[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
  }
  fVar10 = SQRT((*(float *)(param_2 + 0x2e4) - *(float *)(param_1 + 0x2e4)) *
                (*(float *)(param_2 + 0x2e4) - *(float *)(param_1 + 0x2e4)) +
                (*(float *)(param_2 + 0x2e8) - *(float *)(param_1 + 0x2e8)) *
                (*(float *)(param_2 + 0x2e8) - *(float *)(param_1 + 0x2e8)) +
                (*(float *)(param_2 + 0x2e0) - *(float *)(param_1 + 0x2e0)) *
                (*(float *)(param_2 + 0x2e0) - *(float *)(param_1 + 0x2e0)));
LAB_0094aee2:
  return fVar10 < *(float *)(SurvivorBotThreatVeryFarRange._28_4_ + 0x2c);
}

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)