L L4D2node

PlayerBody::AimHeadTowards

0x0076a3d0 · 1350 bytes · __thiscall

_ZN10PlayerBody14AimHeadTowardsERK6VectorN5IBody18LookAtPriorityTypeEfP13INextBotReplyPKcbf

Decompiled

undefined (8 params)

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

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

{
  float fVar1;
  code *pcVar2;
  char cVar3;
  int iVar4;
  uint uVar5;
  undefined4 uVar6;
  INextBot *this_00;
  undefined1 *puVar7;
  undefined1 *puVar8;
  int in_GS_OFFSET;
  longdouble lVar9;
  float fVar10;
  float fVar11;
  INextBot *pIVar12;
  INextBot local_24;
  undefined1 local_23;
  undefined1 local_22;
  undefined1 local_21;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar4 = (**(code **)(*(int *)this + 0x134))(this);
  if ((*(byte *)(iVar4 + 0x150) & 0x20) != 0) {
    this_00 = (INextBot *)(**(code **)(*(int *)this + 0xb0))(this);
    cVar3 = INextBot::IsDebugging(this_00,2);
    if (cVar3 != '\0') {
      uVar6 = (**(code **)(**(int **)(this + 0x14) + 0xb8))(*(int **)(this + 0x14));
      this_00 = &local_24;
      local_24 = (INextBot)0xff;
      local_23 = 0;
      local_22 = 0;
      local_21 = 0xff;
      ConColorMsg(this_00,"%3.2f: %s Look At (%s) rejected - bot is FL_FROZEN\n",
                  (double)*(float *)(gpGlobals + 0xc),uVar6,param_6);
    }
    goto LAB_0076a51c;
  }
  uVar5 = *(uint *)(this + 0x60);
  fVar11 = (float)(~-(uint)(0.0 < param_4) & 0x3dcccccd | (uint)param_4 & -(uint)(0.0 < param_4));
  if ((uVar5 == param_3) && (param_7 != '\0')) {
    cVar3 = (**(code **)(*(int *)this + 0xcc))(this);
    if (cVar3 != '\0') {
      lVar9 = (longdouble)(**(code **)(*(int *)this + 0xd0))(this);
      if (*(float *)(NextBotHeadAimSettleDuration._28_4_ + 0x2c) <= (float)lVar9) {
        uVar5 = *(uint *)(this + 0x60);
        goto LAB_0076a449;
      }
    }
    if (param_5 != (int *)0x0) {
      pcVar2 = *(code **)(*param_5 + 4);
      uVar6 = (**(code **)(*(int *)this + 0xb0))(this);
      (*pcVar2)(param_5,uVar6,0);
    }
    this_00 = (INextBot *)(**(code **)(*(int *)this + 0xb0))(this);
    cVar3 = INextBot::IsDebugging(this_00,2);
    if (cVar3 != '\0') {
      uVar6 = (**(code **)(**(int **)(this + 0x14) + 0xb8))(*(int **)(this + 0x14));
      this_00 = &local_24;
      local_24 = (INextBot)0xff;
      local_23 = 0;
      local_22 = 0;
      local_21 = 0xff;
      ConColorMsg(this_00,"%3.2f: %s Look At (%s) rejected - previous aim not settled\n",
                  (double)*(float *)(gpGlobals + 0xc),uVar6,param_6);
    }
  }
  else {
LAB_0076a449:
    pIVar12 = (INextBot *)(this + 100);
    if ((int)param_3 < (int)uVar5) {
      lVar9 = (longdouble)CountdownTimer::Now();
      if ((float)lVar9 < *(float *)(this + 0x6c)) {
        if (param_5 != (int *)0x0) {
          pcVar2 = *(code **)(*param_5 + 4);
          uVar6 = (**(code **)(*(int *)this + 0xb0))(this);
          (*pcVar2)(param_5,uVar6,0);
        }
        this_00 = (INextBot *)(**(code **)(*(int *)this + 0xb0))(this);
        cVar3 = INextBot::IsDebugging(this_00,2);
        if (cVar3 != '\0') {
          uVar6 = (**(code **)(**(int **)(this + 0x14) + 0xb8))(*(int **)(this + 0x14));
          this_00 = &local_24;
          local_24 = (INextBot)0xff;
          local_23 = 0;
          local_22 = 0;
          local_21 = 0xff;
          ConColorMsg(this_00,"%3.2f: %s Look At (%s) rejected - higher priority aim in progress\n",
                      (double)*(float *)(gpGlobals + 0xc),uVar6,param_6);
        }
        goto LAB_0076a51c;
      }
    }
    if (*(int **)(this + 0x78) != (int *)0x0) {
      pcVar2 = *(code **)(**(int **)(this + 0x78) + 4);
      uVar6 = (**(code **)(*(int *)this + 0xb0))(this);
      (*pcVar2)(*(undefined4 *)(this + 0x78),uVar6,1);
    }
    *(int **)(this + 0x78) = param_5;
    this_00 = pIVar12;
    lVar9 = (longdouble)CountdownTimer::Now();
    if ((float)lVar9 + fVar11 != *(float *)(this + 0x6c)) {
      this_00 = pIVar12;
      (**(code **)(*(int *)(this + 100) + 4))(pIVar12,this + 0x6c);
      *(float *)(this + 0x6c) = (float)lVar9 + fVar11;
    }
    if (fVar11 != *(float *)(this + 0x68)) {
      (**(code **)(*(int *)(this + 100) + 4))(pIVar12,this + 0x68);
      *(float *)(this + 0x68) = fVar11;
      this_00 = pIVar12;
    }
    fVar10 = *(float *)(this + 0x50) - *(float *)param_1;
    if (1.0 <= fVar10 * fVar10 +
               (*(float *)(this + 0x58) - *(float *)(param_1 + 8)) *
               (*(float *)(this + 0x58) - *(float *)(param_1 + 8)) +
               (*(float *)(this + 0x54) - *(float *)(param_1 + 4)) *
               (*(float *)(this + 0x54) - *(float *)(param_1 + 4))) {
      *(float *)(this + 0x50) = *(float *)param_1;
      *(undefined4 *)(this + 0x54) = *(undefined4 *)(param_1 + 4);
      uVar6 = *(undefined4 *)(param_1 + 8);
      *(undefined4 *)(this + 0x5c) = 0xffffffff;
      *(uint *)(this + 0x60) = param_3;
      *(undefined4 *)(this + 0x58) = uVar6;
      lVar9 = (longdouble)IntervalTimer::Now();
      if ((float)lVar9 != *(float *)(this + 0x74)) {
        (**(code **)(*(int *)(this + 0x70) + 4))(this + 0x70,this + 0x74);
        *(float *)(this + 0x74) = (float)lVar9;
      }
      this[0x7c] = (PlayerBody)0x0;
      this[0x7d] = (PlayerBody)0x0;
      *(undefined4 *)(this + 0x88) = param_8;
      this_00 = (INextBot *)(**(code **)(*(int *)this + 0xb0))(this);
      cVar3 = INextBot::IsDebugging(this_00,2);
      if (cVar3 != '\0') {
        NDebugOverlay::Cross3D(param_1,2.0,0xff,0xff,100,true,fVar11 + fVar11);
        puVar7 = &DAT_00d539c2;
        if (param_3 < 5) {
          puVar7 = *(undefined1 **)(CSWTCH_1912 + param_3 * 4);
        }
        fVar11 = *(float *)(param_1 + 8);
        fVar10 = *(float *)(param_1 + 4);
        fVar1 = *(float *)param_1;
        puVar8 = &DAT_00d539c2;
        if (param_6 != (undefined1 *)0x0) {
          puVar8 = param_6;
        }
        uVar6 = (**(code **)(**(int **)(this + 0x14) + 0xb8))(*(int **)(this + 0x14));
        this_00 = &local_24;
        local_24 = (INextBot)0xff;
        local_23 = 100;
        local_22 = 0;
        local_21 = 0xff;
        ConColorMsg(this_00,"%3.2f: %s Look At ( %g, %g, %g ), Pri = %s, Reason = %s\n",
                    (double)*(float *)(gpGlobals + 0xc),uVar6,(double)fVar1,(double)fVar10,
                    (double)fVar11,puVar7,puVar8);
      }
    }
    else {
      *(uint *)(this + 0x60) = param_3;
    }
  }
LAB_0076a51c:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(this_00);
}

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)