L L4D2node

PlayerBody::AimHeadTowards

0x0076b2c0 · 1700 bytes · __thiscall

_ZN10PlayerBody14AimHeadTowardsEP11CBaseEntityN5IBody18LookAtPriorityTypeEfP13INextBotReplyPKcbf

Decompiled

undefined (8 params)

/* PlayerBody::AimHeadTowards(CBaseEntity*, IBody::LookAtPriorityType, float, INextBotReply*, char
   const*, bool, float) */

void __thiscall
PlayerBody::AimHeadTowards
          (PlayerBody *this,int *param_1,uint param_3,float param_4,int *param_5,undefined1 *param_6
          ,char param_7,undefined4 param_8)

{
  code *pcVar1;
  CBaseEdict *pCVar2;
  char cVar3;
  uint uVar4;
  int *piVar5;
  undefined4 *puVar6;
  uint *puVar7;
  int iVar8;
  undefined4 uVar9;
  undefined1 *puVar10;
  INextBot *pIVar11;
  undefined *puVar12;
  int *piVar13;
  undefined1 *puVar14;
  int in_GS_OFFSET;
  longdouble lVar15;
  float fVar16;
  uint local_4c;
  undefined *local_48;
  int local_40;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined1 local_24;
  undefined1 local_23;
  undefined1 local_22;
  undefined1 local_21;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  fVar16 = (float)(~-(uint)(0.0 < param_4) & 0x3dcccccd | (uint)param_4 & -(uint)(0.0 < param_4));
  piVar5 = (int *)&stack0xffffff94;
  if (param_1 == (int *)0x0) goto LAB_0076b650;
  uVar4 = *(uint *)(this + 0x60);
  if ((uVar4 == param_3) && (param_7 != '\0')) {
    cVar3 = (**(code **)(*(int *)this + 0xcc))();
    if (cVar3 != '\0') {
      lVar15 = (longdouble)(**(code **)(*(int *)this + 0xd0))();
      if (*(float *)(NextBotHeadAimSettleDuration._28_4_ + 0x2c) <= (float)lVar15) {
        uVar4 = *(uint *)(this + 0x60);
        goto LAB_0076b326;
      }
    }
    if (param_5 != (int *)0x0) {
      pcVar1 = *(code **)(*param_5 + 4);
      (**(code **)(*(int *)this + 0xb0))();
      (*pcVar1)();
    }
    pIVar11 = (INextBot *)(**(code **)(*(int *)this + 0xb0))();
    cVar3 = INextBot::IsDebugging(pIVar11,2);
    piVar5 = (int *)&stack0xffffff94;
    if (cVar3 != '\0') {
      (**(code **)(**(int **)(this + 0x14) + 0xb8))();
      local_24 = 0xff;
      local_23 = 0;
      local_22 = 0;
      local_21 = 0xff;
      ConColorMsg(&local_24,"%3.2f: %s Look At (%s) rejected - previous aim not settled\n");
      piVar5 = (int *)&stack0xffffff94;
    }
    goto LAB_0076b650;
  }
LAB_0076b326:
  if ((int)param_3 < (int)uVar4) {
    lVar15 = (longdouble)CountdownTimer::Now();
    if ((float)lVar15 < *(float *)(this + 0x6c)) {
      if (param_5 != (int *)0x0) {
        pcVar1 = *(code **)(*param_5 + 4);
        (**(code **)(*(int *)this + 0xb0))();
        (*pcVar1)();
      }
      pIVar11 = (INextBot *)(**(code **)(*(int *)this + 0xb0))();
      cVar3 = INextBot::IsDebugging(pIVar11,2);
      piVar5 = (int *)&stack0xffffff94;
      if (cVar3 != '\0') {
        (**(code **)(**(int **)(this + 0x14) + 0xb8))();
        local_24 = 0xff;
        local_23 = 0;
        local_22 = 0;
        local_21 = 0xff;
        ConColorMsg(&local_24,"%3.2f: %s Look At (%s) rejected - higher priority aim in progress\n")
        ;
        piVar5 = (int *)&stack0xffffff94;
      }
      goto LAB_0076b650;
    }
  }
  if (*(int **)(this + 0x78) != (int *)0x0) {
    pcVar1 = *(code **)(**(int **)(this + 0x78) + 4);
    (**(code **)(*(int *)this + 0xb0))();
    (*pcVar1)();
  }
  *(int **)(this + 0x78) = param_5;
  lVar15 = (longdouble)CountdownTimer::Now();
  if ((float)lVar15 + fVar16 != *(float *)(this + 0x6c)) {
    (**(code **)(*(int *)(this + 100) + 4))();
    *(float *)(this + 0x6c) = (float)lVar15 + fVar16;
  }
  if (fVar16 != *(float *)(this + 0x68)) {
    (**(code **)(*(int *)(this + 100) + 4))();
    *(float *)(this + 0x68) = fVar16;
  }
  uVar4 = *(uint *)(this + 0x5c);
  if ((((uVar4 != 0xffffffff) &&
       (puVar12 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar12 + 8) == uVar4 >> 0xc)) && (param_1 == *(int **)(puVar12 + 4))) {
    *(uint *)(this + 0x60) = param_3;
    piVar5 = (int *)&stack0xffffff94;
    goto LAB_0076b650;
  }
  piVar5 = (int *)(**(code **)(*(int *)this + 0x134))();
  if (piVar5 == (int *)0x0) {
LAB_0076b670:
    piVar5 = (int *)0x0;
  }
  else {
    cVar3 = (**(code **)(*piVar5 + 0x16c))();
    if (cVar3 == '\0') goto LAB_0076b670;
  }
  puVar6 = (undefined4 *)(**(code **)(*param_1 + 0xc))();
  *(undefined4 *)(this + 0x5c) = *puVar6;
  cVar3 = (**(code **)(*param_1 + 0x16c))();
  if (cVar3 == '\0') {
    puVar6 = (undefined4 *)(**(code **)(*param_1 + 0x288))();
    *(undefined4 *)(this + 0x50) = *puVar6;
    *(undefined4 *)(this + 0x54) = puVar6[1];
    *(undefined4 *)(this + 0x58) = puVar6[2];
    piVar13 = (int *)&stack0xffffff94;
    if (piVar5 != (int *)0x0) {
      uVar4 = piVar5[0xff7];
      piVar13 = (int *)&stack0xffffff94;
      if (((uVar4 != 0xffffffff) &&
          (puVar12 = g_pEntityList + (uVar4 & 0xfff) * 0x10, piVar13 = (int *)&stack0xffffff94,
          puVar12 != (undefined *)0xfffffffc)) &&
         ((piVar13 = (int *)&stack0xffffff94, *(uint *)(puVar12 + 8) == uVar4 >> 0xc &&
          (piVar13 = (int *)&stack0xffffff94, *(int *)(puVar12 + 4) != 0)))) {
        if ((char)piVar5[0x1b] == '\0') {
          pCVar2 = (CBaseEdict *)piVar5[0xc];
          if (pCVar2 != (CBaseEdict *)0x0) {
            *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
            iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
            *(undefined2 *)(iVar8 + 2) = 0;
          }
        }
        else {
          *(byte *)(piVar5 + 0x1c) = *(byte *)(piVar5 + 0x1c) | 1;
        }
        piVar5[0xff7] = -1;
        piVar13 = (int *)&stack0xffffff94;
      }
    }
  }
  else {
    cVar3 = (**(code **)(*param_1 + 0x16c))();
    if (cVar3 == '\0') {
      (**(code **)(*param_1 + 0x234))();
      *(undefined4 *)(this + 0x50) = local_30;
      *(undefined4 *)(this + 0x54) = local_2c;
      *(undefined4 *)(this + 0x58) = local_28;
      piVar13 = (int *)&stack0xffffff90;
      if (piVar5 != (int *)0x0) {
        local_48 = g_pEntityList;
        local_4c = 0xffffffff;
        local_40 = 0;
        goto LAB_0076b4b9;
      }
    }
    else {
      (**(code **)(*param_1 + 0x234))();
      *(undefined4 *)(this + 0x50) = local_30;
      *(undefined4 *)(this + 0x54) = local_2c;
      *(undefined4 *)(this + 0x58) = local_28;
      piVar13 = (int *)&stack0xffffff90;
      if (piVar5 != (int *)0x0) {
        puVar7 = (uint *)(**(code **)(*param_1 + 0xc))();
        local_4c = *puVar7;
        local_48 = g_pEntityList;
        if (((local_4c == 0xffffffff) ||
            (puVar12 = g_pEntityList + (local_4c & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc
            )) || (*(uint *)(puVar12 + 8) != local_4c >> 0xc)) {
          local_40 = 0;
        }
        else {
          local_40 = *(int *)(puVar12 + 4);
        }
LAB_0076b4b9:
        uVar4 = piVar5[0xff7];
        if (((uVar4 == 0xffffffff) ||
            (puVar12 = local_48 + (uVar4 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
           (*(uint *)(puVar12 + 8) != uVar4 >> 0xc)) {
          iVar8 = 0;
        }
        else {
          iVar8 = *(int *)(puVar12 + 4);
        }
        piVar13 = (int *)&stack0xffffff90;
        g_pEntityList = local_48;
        if (local_40 != iVar8) {
          if ((char)piVar5[0x1b] == '\0') {
            pCVar2 = (CBaseEdict *)piVar5[0xc];
            if (pCVar2 != (CBaseEdict *)0x0) {
              *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
              iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
              *(undefined2 *)(iVar8 + 2) = 0;
            }
          }
          else {
            *(byte *)(piVar5 + 0x1c) = *(byte *)(piVar5 + 0x1c) | 1;
          }
          piVar5[0xff7] = local_4c;
          piVar13 = (int *)&stack0xffffff90;
        }
      }
    }
  }
  *(uint *)(this + 0x60) = param_3;
  *piVar13 = (int)(this + 0x70);
  piVar13[-1] = 0x76b52b;
  lVar15 = (longdouble)IntervalTimer::Now();
  if ((float)lVar15 != *(float *)(this + 0x74)) {
    iVar8 = *(int *)(this + 0x70);
    *piVar13 = (int)(this + 0x70);
    piVar13[1] = (int)(this + 0x74);
    pcVar1 = *(code **)(iVar8 + 4);
    piVar13[-1] = 0x76b549;
    (*pcVar1)();
    *(float *)(this + 0x74) = (float)lVar15;
  }
  iVar8 = *(int *)this;
  this[0x7c] = (PlayerBody)0x0;
  this[0x7d] = (PlayerBody)0x0;
  *(undefined4 *)(this + 0x88) = param_8;
  *piVar13 = (int)this;
  pcVar1 = *(code **)(iVar8 + 0xb0);
  piVar13[-1] = 0x76b573;
  uVar9 = (*pcVar1)();
  piVar13[1] = 2;
  *piVar13 = uVar9;
  piVar13[-1] = 0x76b583;
  cVar3 = INextBot::IsDebugging((INextBot *)*piVar13,piVar13[1]);
  piVar5 = piVar13;
  if (cVar3 != '\0') {
    piVar13[5] = 1;
    piVar13[4] = 100;
    puVar14 = &DAT_00d539c2;
    piVar13[6] = (int)fVar16;
    piVar13[3] = 100;
    piVar13[2] = 100;
    piVar13[1] = 0x40000000;
    *piVar13 = (int)(this + 0x50);
    piVar13[-1] = 0x76b5ce;
    NDebugOverlay::Cross3D
              ((Vector *)*piVar13,(float)piVar13[1],piVar13[2],piVar13[3],piVar13[4],
               SUB41(piVar13[5],0),(float)piVar13[6]);
    if (param_3 < 4) {
      puVar14 = *(undefined1 **)(CSWTCH_1997 + param_3 * 4);
    }
    if (param_6 == (undefined1 *)0x0) {
      param_6 = &DAT_00d539c2;
    }
    puVar10 = &DAT_00d539c2;
    if ((undefined1 *)param_1[0x1f] != (undefined1 *)0x0) {
      puVar10 = (undefined1 *)param_1[0x1f];
    }
    iVar8 = **(int **)(this + 0x14);
    *piVar13 = (int)*(int **)(this + 0x14);
    pcVar1 = *(code **)(iVar8 + 0xb8);
    piVar13[-1] = 0x76b606;
    iVar8 = (*pcVar1)();
    fVar16 = *(float *)(gpGlobals + 0xc);
    piVar13[4] = iVar8;
    piVar13[7] = (int)param_6;
    piVar13[6] = (int)puVar14;
    piVar13[5] = (int)puVar10;
    *(double *)(piVar13 + 2) = (double)fVar16;
    piVar13[1] = (int)"%3.2f: %s Look At subject %s, Pri = %s, Reason = %s\n";
    *piVar13 = (int)&local_24;
    local_24 = 0xff;
    local_23 = 100;
    local_22 = 0;
    local_21 = 0xff;
    piVar13[-1] = 0x76b650;
    ConColorMsg((Color *)*piVar13,(char *)piVar13[1]);
  }
LAB_0076b650:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  *(undefined **)((int)piVar5 + -4) = &UNK_0076b9ae;
  __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)