L L4D2node

CTerrorPlayer::UpdateViewOffset

0x004f4780 · 1067 bytes · __cdecl

_ZN13CTerrorPlayer16UpdateViewOffsetERK6VectorRK6QAngle

Decompiled

undefined (2 params)

/* CTerrorPlayer::UpdateViewOffset(Vector const&, QAngle const&) */

Vector * CTerrorPlayer::UpdateViewOffset(Vector *param_1,QAngle *param_2)

{
  undefined4 uVar1;
  uint uVar2;
  char cVar3;
  int iVar4;
  CBaseEntity *this;
  undefined *puVar5;
  float fVar6;
  QAngle *in_stack_0000000c;
  float *in_stack_00000010;
  float local_4c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  undefined4 local_34;
  undefined4 local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  iVar4 = (**(code **)(*(int *)param_2 + 0x250))(param_2);
  local_4c = 0.0;
  local_44 = *(float *)(iVar4 + 8);
  local_48 = 0.0;
  this = (CBaseEntity *)GetMountedWeapon((CTerrorPlayer *)param_2);
  if (this == (CBaseEntity *)0x0) {
    cVar3 = (**(code **)(*(int *)param_2 + 300))(param_2);
    if ((cVar3 == '\0') || (param_2[0x39f1] == (QAngle)0x0)) {
      cVar3 = (**(code **)(*(int *)param_2 + 300))(param_2);
      if ((cVar3 == '\0') || (param_2[0x33dc] == (QAngle)0x0)) {
        cVar3 = (**(code **)(*(int *)param_2 + 0x7e8))(param_2);
        if (cVar3 == '\0') {
          uVar2 = *(uint *)(param_2 + 0x3e68);
          if ((((uVar2 == 0xffffffff) ||
               (puVar5 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc))
              || (*(uint *)(puVar5 + 8) != uVar2 >> 0xc)) || (*(int *)(puVar5 + 4) == 0)) {
            uVar2 = *(uint *)(param_2 + 0x3ee0);
            if (((uVar2 == 0xffffffff) ||
                (puVar5 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc)
                ) || ((*(uint *)(puVar5 + 8) != uVar2 >> 0xc || (*(int *)(puVar5 + 4) == 0)))) {
              cVar3 = (**(code **)(*(int *)param_2 + 300))(param_2);
              if ((cVar3 == '\0') || (((byte)param_2[0x14c] & 4) != 0)) {
                cVar3 = (**(code **)(*(int *)param_2 + 300))(param_2);
                fVar6 = local_44;
                if ((cVar3 != '\0') &&
                   (iVar4 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules),
                   fVar6 < *(float *)(iVar4 + 8))) {
LAB_004f4b9e:
                  iVar4 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
                  local_44 = *(float *)(iVar4 + 8);
                }
              }
              else if (param_2[0x1a91] == (QAngle)0x0) {
                if (((byte)param_2[0x150] & 2) == 0) {
                  if (param_2[0x1a90] == (QAngle)0x0) goto LAB_004f4b9e;
                }
                else if (param_2[0x1a90] == (QAngle)0x0) goto LAB_004f492f;
                iVar4 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
                local_44 = *(float *)(iVar4 + 0x44);
              }
            }
          }
          else {
            local_44 = *(float *)(SurvivorPounceVictimEyeHeight._28_4_ + 0x2c);
          }
        }
        else {
          iVar4 = GetPlayerViewOffset((CTerrorPlayer *)param_2,false);
          local_44 = *(float *)(iVar4 + 8);
        }
      }
      else {
        local_44 = *(float *)(SurvivorHangingFromTongueEyeHeight._28_4_ + 0x2c);
      }
    }
    else {
      local_44 = *(float *)(SurvivorHangingEyeHeight._28_4_ + 0x2c);
    }
LAB_004f492f:
    cVar3 = (**(code **)(*(int *)param_2 + 300))(param_2);
    if (cVar3 == '\0') {
      iVar4 = (**(code **)(*(int *)param_2 + 0x648))(param_2);
      if (iVar4 == 6) {
        iVar4 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
        *(undefined4 *)param_1 = *(undefined4 *)(iVar4 + 0x60);
        uVar1 = *(undefined4 *)(iVar4 + 0x68);
        *(undefined4 *)(param_1 + 4) = *(undefined4 *)(iVar4 + 100);
        *(undefined4 *)(param_1 + 8) = uVar1;
        return param_1;
      }
    }
    else {
      CalcLeanViewOffset((Vector *)&local_28,in_stack_0000000c,(float)in_stack_00000010,
                         SUB41(local_44,0));
      local_4c = local_28;
      local_48 = local_24;
      local_44 = local_20;
    }
    goto LAB_004f48b9;
  }
  fVar6 = *in_stack_00000010;
  if (180.0 < fVar6) {
    fVar6 = fVar6 - 360.0;
    if (0.0 < fVar6) goto LAB_004f47ec;
LAB_004f48f5:
    fVar6 = 54.0;
  }
  else {
    if (fVar6 <= 0.0) goto LAB_004f48f5;
LAB_004f47ec:
    fVar6 = (1.0 - fVar6 * 0.011111111) * 54.0 + fVar6 * 0.011111111 * 62.0;
  }
  (**(code **)(*(int *)this + 0x234))(&local_40,this);
  local_34 = 0;
  local_30 = 0;
  local_2c = fVar6;
  if (((byte)this[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(this);
  }
  local_28 = *(float *)(this + 0x37c);
  local_24 = *(float *)(this + 0x380);
  local_20 = *(float *)(this + 900);
  VectorRotate((Vector *)&local_34,(QAngle *)&local_28,(Vector *)&local_4c);
  local_4c = (local_40 + local_4c) - *(float *)in_stack_0000000c;
  local_48 = (local_3c + local_48) - *(float *)(in_stack_0000000c + 4);
LAB_004f48b9:
  *(float *)param_1 = local_4c;
  *(float *)(param_1 + 4) = local_48;
  *(float *)(param_1 + 8) = local_44;
  return param_1;
}

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)