L L4D2node

CTerrorPlayer::OnLedgeGrabbed

0x009b47f0 · 2916 bytes · __thiscall

_ZN13CTerrorPlayer14OnLedgeGrabbedERK6Vector

Decompiled

undefined (2 params)

/* CTerrorPlayer::OnLedgeGrabbed(Vector const&) */

void __thiscall CTerrorPlayer::OnLedgeGrabbed(CTerrorPlayer *this,Vector *param_1)

{
  CBaseEdict *pCVar1;
  code *pcVar2;
  char cVar3;
  CTerrorPlayer *pCVar4;
  int iVar5;
  CBaseEntity *this_00;
  undefined4 uVar6;
  int *piVar7;
  char *pcVar8;
  CTerrorPlayer *pCVar9;
  undefined *puVar10;
  uint uVar11;
  uint uVar12;
  undefined4 *puVar13;
  int in_GS_OFFSET;
  byte bVar14;
  longdouble lVar15;
  float fVar16;
  code *local_670;
  CTerrorPlayer *local_668;
  char *local_664;
  char *local_660;
  char local_65c [4];
  undefined4 local_658 [63];
  CFmtStrN<256> local_55c [5];
  undefined1 local_557 [263];
  CFmtStrN<256> local_450 [5];
  undefined1 local_44b [263];
  CFmtStrN<256> local_344 [5];
  undefined1 local_33f [263];
  CFmtStrN<256> local_238 [5];
  undefined1 local_233 [263];
  CFmtStrN<256> local_12c [5];
  undefined1 local_127 [263];
  int local_20;
  
  bVar14 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pCVar4 = this;
  cVar3 = (**(code **)(*(int *)this + 300))(this);
  if ((cVar3 == '\0') ||
     (pCVar4 = this, cVar3 = (**(code **)(*(int *)this + 0x7e8))(this), cVar3 != '\0'))
  goto LAB_009b481c;
  pCVar4 = (CTerrorPlayer *)CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  cVar3 = IsASurvivorTeam((int)pCVar4);
  if ((cVar3 == '\0') ||
     ((this[0x39f0] == (CTerrorPlayer)0x0 || (this[0x400d] == (CTerrorPlayer)0x0))))
  goto LAB_009b481c;
  CBasePlayer::ClearUseEntity((CBasePlayer *)this);
  SetPushEntity(this,(CBaseEntity *)0x0);
  this[0x39f0] = (CTerrorPlayer)0x0;
  if (this[0x39f1] != (CTerrorPlayer)0x1) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    this[0x39f1] = (CTerrorPlayer)0x1;
  }
  ResetLightingOrigin(this);
  this_00 = (CBaseEntity *)CreateEntityByName("info_hang_lighting",-1,true);
  CBaseEntity::SetAbsOrigin(this_00,(Vector *)(this + 0x3a14));
  (**(code **)(*(int *)this + 0x3a0))(this,this_00);
  if (this[0x39f2] != (CTerrorPlayer)0x0) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    this[0x39f2] = (CTerrorPlayer)0x0;
  }
  fVar16 = *(float *)param_1;
  if (((fVar16 != *(float *)(this + 0x39fc)) ||
      (*(float *)(param_1 + 4) != *(float *)(this + 0x3a00))) ||
     (*(float *)(param_1 + 8) != *(float *)(this + 0x3a04))) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar5 + 2) = 0;
        fVar16 = *(float *)param_1;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      fVar16 = *(float *)param_1;
    }
    *(float *)(this + 0x39fc) = fVar16;
    *(undefined4 *)(this + 0x3a00) = *(undefined4 *)(param_1 + 4);
    *(undefined4 *)(this + 0x3a04) = *(undefined4 *)(param_1 + 8);
  }
  CBaseEntity::SetMoveType((CBaseEntity *)this,0xb,0);
  lVar15 = (longdouble)IntervalTimer::Now();
  if ((float)lVar15 != *(float *)(this + 0x39f8)) {
    (**(code **)(*(int *)(this + 0x39f4) + 4))(this + 0x39f4,this + 0x39f8);
    *(float *)(this + 0x39f8) = (float)lVar15;
  }
  uVar6 = SurvivorLedgeGrabGroundCheckTime._28_4_;
  this[0x3a2c] = (CTerrorPlayer)0x0;
  fVar16 = *(float *)(uVar6 + 0x2c);
  lVar15 = (longdouble)CountdownTimer::Now();
  if ((float)lVar15 + fVar16 != *(float *)(this + 0x3a70)) {
    (**(code **)(*(int *)(this + 0x3a68) + 4))(this + 0x3a68,this + 0x3a70);
    *(float *)(this + 0x3a70) = (float)lVar15 + fVar16;
  }
  if (fVar16 != *(float *)(this + 0x3a6c)) {
    (**(code **)(*(int *)(this + 0x3a68) + 4))(this + 0x3a68,this + 0x3a6c);
    *(float *)(this + 0x3a6c) = fVar16;
  }
  uVar11 = 0;
  CFmtStrN<256>::CFmtStrN
            (local_55c,"(%f, %f, %f)",(double)*(float *)(this + 0x289c),
             (double)*(float *)(this + 0x28a0),(double)*(float *)(this + 0x28a4));
  CFmtStrN<256>::CFmtStrN
            (local_450,"(%f, %f, %f)",(double)*(float *)(this + 0x3a08),
             (double)*(float *)(this + 0x3a0c),(double)*(float *)(this + 0x3a10));
  CFmtStrN<256>::CFmtStrN
            (local_344,"(%f, %f, %f)",(double)*(float *)(this + 0x3a30),
             (double)*(float *)(this + 0x3a34),(double)*(float *)(this + 0x3a38));
  CFmtStrN<256>::CFmtStrN
            (local_238,"(%f, %f, %f)",(double)*(float *)(this + 0x3a14),
             (double)*(float *)(this + 0x3a18),(double)*(float *)(this + 0x3a1c));
  CFmtStrN<256>::CFmtStrN
            (local_12c,"(%f, %f, %f)",(double)*(float *)(this + 0x3a3c),
             (double)*(float *)(this + 0x3a40),(double)*(float *)(this + 0x3a44));
  if (0.0 < *(float *)(this + 0x31dc)) {
    lVar15 = (longdouble)CountdownTimer::Now();
    uVar11 = (uint)((float)lVar15 < *(float *)(this + 0x31dc));
  }
  uVar12 = *(uint *)(this + 0x33c4);
  if (((uVar12 == 0xffffffff) ||
      (puVar10 = g_pEntityList + (uVar12 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar10 + 8) != uVar12 >> 0xc)) {
    uVar12 = 0;
  }
  else {
    uVar12 = (uint)(*(int *)(puVar10 + 4) != 0);
  }
  uVar6 = (**(code **)(*(int *)this + 0xb8))(this);
  UTIL_LogPrintf("%s grabs a ledge - last standing at %s.  hang pos is %s.  fall pos is %s.  stand target is %s.  landing target is %s.  IsTongueVictim() == %d, IsBeingLunged() == %d\n"
                 ,uVar6,local_557,local_44b,local_33f,local_233,local_127,uVar12,uVar11);
  StopRevivingSomeone(this,true);
  if (this[0x2d94] != (CTerrorPlayer)0x1) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    this[0x2d94] = (CTerrorPlayer)0x1;
  }
  *(undefined4 *)(this + 0x39e8) = *(undefined4 *)(this + 0x100);
  lVar15 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this);
  *(int *)(this + 0x39ec) = (int)lVar15;
  iVar5 = *(int *)(SurvivorLedgeGrabHealth._28_4_ + 0x30);
  if (iVar5 != *(int *)(this + 0x100)) {
    (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
    *(int *)(this + 0x100) = iVar5;
  }
  lVar15 = (longdouble)CountdownTimer::Now();
  if ((float)lVar15 + 1.0 != *(float *)(this + 0x2da4)) {
    (**(code **)(*(int *)(this + 0x2d9c) + 4))(this + 0x2d9c,this + 0x2da4);
    *(float *)(this + 0x2da4) = (float)lVar15 + 1.0;
  }
  if (*(float *)(this + 0x2da0) != 1.0) {
    (**(code **)(*(int *)(this + 0x2d9c) + 4))(this + 0x2d9c,this + 0x2da0);
    *(undefined4 *)(this + 0x2da0) = 0x3f800000;
  }
  iVar5 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
  if (iVar5 != 0) {
    piVar7 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
    (**(code **)(*piVar7 + 0x428))(piVar7,0);
  }
  uVar11 = *(uint *)(this + 0x3ee0);
  if (((uVar11 != 0xffffffff) &&
      (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
     ((*(uint *)(puVar10 + 8) == uVar11 >> 0xc &&
      (*(CTerrorPlayer **)(puVar10 + 4) != (CTerrorPlayer *)0x0)))) {
    OnRideEnded(*(CTerrorPlayer **)(puVar10 + 4),(CTerrorPlayer *)0x0);
  }
  uVar11 = *(uint *)(this + 0x33c4);
  if ((((uVar11 != 0xffffffff) &&
       (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar10 + 8) == uVar11 >> 0xc)) &&
     (*(CTerrorPlayer **)(puVar10 + 4) != (CTerrorPlayer *)0x0)) {
    ReleaseTongueVictim(*(CTerrorPlayer **)(puVar10 + 4),false);
  }
  (**(code **)(*(int *)this + 0x850))(this,*(undefined4 *)(ZombieNoiseLevelVocalize._28_4_ + 0x2c));
  pcVar2 = *(code **)(*(int *)this + 0x7b4);
  CAI_Concept::CAI_Concept((CAI_Concept *)&local_668,"PlayerLedgeHangStart");
  (*pcVar2)(this,(CAI_Concept *)&local_668,1,0,0,0,0);
  lVar15 = (longdouble)CountdownTimer::Now();
  if ((float)lVar15 + 5.0 != *(float *)(this + 0x30a0)) {
    (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x30a0);
    *(float *)(this + 0x30a0) = (float)lVar15 + 5.0;
  }
  if (*(float *)(this + 0x309c) != 5.0) {
    (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x309c);
    *(undefined4 *)(this + 0x309c) = 0x40a00000;
  }
  (**(code **)(*(int *)(this + 0x3ab4) + 0x110))(this + 0x3ab4);
  lVar15 = (longdouble)CountdownTimer::Now();
  if (((float)lVar15 < *(float *)(this + 0x31dc)) ||
     (lVar15 = (longdouble)CountdownTimer::Now(), (float)lVar15 < *(float *)(this + 0x3294))) {
    Intensity::Increase((Intensity *)(this + 12000),3);
  }
  puVar13 = local_658;
  for (iVar5 = 0x3f; iVar5 != 0; iVar5 = iVar5 + -1) {
    *puVar13 = 0;
    puVar13 = puVar13 + (uint)bVar14 * -2 + 1;
  }
  local_65c[0] = '\0';
  local_65c[1] = '\0';
  local_65c[2] = '\0';
  local_65c[3] = '\0';
  V_strncat(local_65c,"HangingCharacter:",0x100,-1);
  pcVar8 = (char *)SurvivorCharacterName(*(undefined4 *)(this + 0x2ba0));
  V_strncat(local_65c,pcVar8,0x100,-1);
  local_664 = "SurvivorGrabbedLedge";
  local_668 = this;
  local_660 = local_65c;
  ForEachTerrorPlayer<DispatchResponseToSurvivorsWithVisibility>
            ((DispatchResponseToSurvivorsWithVisibility *)&local_668);
  pCVar4 = (CTerrorPlayer *)GetRecentPusher(this);
  piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"player_ledge_grab",0,0);
  if (piVar7 != (int *)0x0) {
    pcVar2 = *(code **)(*piVar7 + 0x30);
    uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
    (*pcVar2)(piVar7,"userid",uVar6);
    if ((pCVar4 == (CTerrorPlayer *)0x0) ||
       (cVar3 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4), cVar3 == '\0')) {
      iVar5 = GetRecentPullPlayer(this);
      if (iVar5 != 0) {
        local_670 = *(code **)(*piVar7 + 0x30);
        iVar5 = GetRecentPullPlayer(this);
        uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(iVar5 + 0x30));
        goto LAB_009b5052;
      }
      uVar11 = *(uint *)(this + 0x33c4);
      if ((((uVar11 != 0xffffffff) &&
           (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
          && (*(uint *)(puVar10 + 8) == uVar11 >> 0xc)) &&
         (pCVar9 = *(CTerrorPlayer **)(puVar10 + 4), pCVar9 != (CTerrorPlayer *)0x0)) {
        local_670 = *(code **)(*piVar7 + 0x30);
        goto LAB_009b503d;
      }
    }
    else {
      local_670 = *(code **)(*piVar7 + 0x30);
      cVar3 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4);
      pCVar9 = (CTerrorPlayer *)0x0;
      if (cVar3 != '\0') {
        pCVar9 = pCVar4;
      }
LAB_009b503d:
      uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar9 + 0x30));
LAB_009b5052:
      (*local_670)(piVar7,"causer",uVar6);
    }
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
  }
  ElectHeroicSurvivorBot(this);
  if (((pCVar4 != (CTerrorPlayer *)0x0) &&
      (iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar5 == 2)) &&
     ((iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)pCVar4), iVar5 == 3 &&
      (cVar3 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4), cVar3 != '\0')))) {
    AddSurvivorDamage(pCVar4,0x32,0,*(undefined4 *)(this + 0x2ba0));
  }
  ElectHeroicSurvivorBot(this);
  pCVar4 = this;
LAB_009b481c:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail(pCVar4);
  }
  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)