L L4D2node

SurvivorBot::PhysicsSimulate

0x00943150 · 2726 bytes · __thiscall

_ZN11SurvivorBot15PhysicsSimulateEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SurvivorBot::PhysicsSimulate() */

void __thiscall SurvivorBot::PhysicsSimulate(SurvivorBot *this)

{
  float fVar1;
  float fVar2;
  uint uVar3;
  CBaseEdict *this_00;
  char cVar4;
  CBaseEntity *this_01;
  int iVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  undefined4 uVar8;
  int iVar9;
  size_t sVar10;
  char *pcVar11;
  int *piVar12;
  float *pfVar13;
  undefined4 *puVar14;
  undefined *puVar15;
  longdouble lVar16;
  longdouble lVar17;
  float fVar18;
  CBaseEntity *pCVar19;
  undefined4 local_8c;
  undefined4 local_88;
  undefined4 local_80;
  undefined4 local_7c;
  int local_78;
  undefined **local_74;
  float local_70;
  float local_6c;
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined1 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined2 local_3c;
  undefined2 local_3a;
  undefined1 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  local_8c = 0;
  local_88 = 0;
  if (___atan2f_finite == 0) {
    local_78 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_8c,0,0,0,0,
               "/data/src/game/server/terror/survivorbot/survivorbot.cpp",0x444,
               &PhysicsSimulate()::tm_fmt,"(%s)%s","Unaccounted","SurvivorBot::PhysicsSimulate");
    local_78 = ___atan2f_finite;
  }
  iVar5 = _DAT_0105db00;
  local_80 = local_8c;
  local_7c = local_88;
                    /* try { // try from 00943386 to 009433d4 has its CatchHandler @ 00943c71 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar9 = ThreadGetCurrentId(), iVar5 == iVar9)) {
    if ((char *)*_DAT_0105d15c != "SurvivorBot::PhysicsSimulate") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd07b42,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  pCVar19 = (CBaseEntity *)this;
                    /* try { // try from 00943218 to 009432bf has its CatchHandler @ 00943c75 */
  Maintain(this);
  iVar5 = *(int *)(this + 0x4308);
  if (iVar5 < 1) {
    fVar18 = *(float *)(SurvivorBotReplacementInterval._28_4_ + 0x2c);
    if (0.0 < fVar18) {
      pCVar19 = (CBaseEntity *)(this + 0x4338);
      lVar16 = (longdouble)IntervalTimer::Now();
      if (fVar18 < (float)lVar16 - *(float *)(this + 0x433c)) {
        pCVar19 = (CBaseEntity *)this;
        CTerrorPlayer::ReplaceWithBot((CTerrorPlayer *)this,true);
      }
    }
  }
  else {
    this_01 = (CBaseEntity *)UTIL_PlayerByUserId(iVar5);
    if ((this_01 == (CBaseEntity *)0x0) ||
       (cVar4 = (**(code **)(*(int *)this_01 + 0x16c))(this_01), cVar4 == '\0')) {
      if (this[0x4335] != (SurvivorBot)0x0) {
                    /* try { // try from 00943403 to 00943610 has its CatchHandler @ 00943c75 */
        cVar4 = (**(code **)(*engine + 0x48))(engine,iVar5);
        if (cVar4 != '\0') {
                    /* try { // try from 00943bde to 00943c34 has its CatchHandler @ 00943c75 */
          iVar5 = (**(code **)(*engine + 0x4c))(engine,iVar5);
          if (iVar5 != *(int *)(this + 0x4330)) {
            if (this[0x6c] == (SurvivorBot)0x0) {
              this_00 = *(CBaseEdict **)(this + 0x30);
              if (this_00 != (CBaseEdict *)0x0) {
                *(uint *)this_00 = *(uint *)this_00 | 0x101;
                iVar9 = CBaseEdict::GetChangeAccessor(this_00);
                *(undefined2 *)(iVar9 + 2) = 0;
              }
            }
            else {
              this[0x70] = (SurvivorBot)((byte)this[0x70] | 1);
            }
            *(int *)(this + 0x4330) = iVar5;
          }
          cVar4 = CDirector::HasAnySurvivorLeftSafeArea(TheDirector);
          if (cVar4 == '\0') {
            CBasePlayer::PhysicsSimulate((CBasePlayer *)this);
            pCVar19 = (CBaseEntity *)this;
          }
          else {
            NextBotPlayer<CTerrorPlayer>::PhysicsSimulate((NextBotPlayer<CTerrorPlayer> *)this);
            pCVar19 = (CBaseEntity *)this;
          }
          goto LAB_00943317;
        }
        if (*(int *)(SurvivorBotTransition._28_4_ + 0x30) != 0) {
          uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
          uVar7 = (**(code **)(*(int *)this + 0xb8))(this);
          UTIL_LogPrintf("%s<%d> TIMED OUT TRANSITIONING PLAYER %d\n",uVar7,uVar6,iVar5);
          RemoveTransitioningPlayerRecord(iVar5);
          if (this[0x4334] != (SurvivorBot)0x0) {
            this[0x4334] = (SurvivorBot)0x0;
          }
        }
      }
    }
    else {
      pCVar19 = this_01;
      iVar5 = CBaseEntity::GetTeamNumber(this_01);
      if (iVar5 == 1) goto LAB_009432c0;
      if ((*(int *)(SurvivorBotTransition._28_4_ + 0x30) != 0) && (this[0x4335] != (SurvivorBot)0x0)
         ) {
        uVar6 = (**(code **)(*(int *)this_01 + 0xb8))(this_01);
        uVar7 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
        uVar8 = (**(code **)(*(int *)this + 0xb8))(this);
        UTIL_LogPrintf("%s<%d> STOPS BEING HELD BY NON-SPECTATOR %s\n",uVar8,uVar7,uVar6);
      }
    }
    pCVar19 = (CBaseEntity *)this;
    ResetHumanSpectator(this);
  }
LAB_009432c0:
  uVar3 = *(uint *)(this + 0x33a4);
  if ((((uVar3 == 0xffffffff) ||
       (puVar15 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar15 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar15 + 8) != uVar3 >> 0xc)) || (*(int *)(puVar15 + 4) == 0)) {
    iVar5 = *(int *)(SurvivorBotStop._28_4_ + 0x30);
    if (iVar5 != 0) goto joined_r0x00943303;
    if ((*(int *)(NextBotStop._28_4_ + 0x30) != 0) || (((byte)this[0x150] & 0x20) != 0))
    goto LAB_00943305;
    iVar5 = TheNextBots();
    if (*(int *)(iVar5 + 0x4c) == 0) {
LAB_0094353c:
      if (*(int *)(SurvivorBotCrouch._28_4_ + 0x30) != 0) {
                    /* try { // try from 00943abd to 00943ae0 has its CatchHandler @ 00943c75 */
        (**(code **)(*(int *)this + 0x980))(this,0xbf800000);
      }
      if (*(int *)(SurvivorBotOpenFire._28_4_ + 0x30) != 0) {
        if (this[0x1ab9c] == (SurvivorBot)0x0) {
          (**(code **)(*(int *)this + 0x938))(this,0xbf800000);
        }
        else {
          (**(code **)(*(int *)this + 0x93c))(this);
        }
        this[0x1ab9c] = (SurvivorBot)((byte)this[0x1ab9c] ^ 1);
      }
    }
    else {
      iVar5 = TheNextBots();
      cVar4 = (**(code **)(**(int **)(iVar5 + 0x4c) + 0xe0))(*(int **)(iVar5 + 0x4c),this);
      if (cVar4 != '\0') goto LAB_0094353c;
    }
    if (*(int *)(SurvivorBotPerfCrawl._28_4_ + 0x30) == 0) goto LAB_009436b0;
    pcVar11 = "FCVAR_NEVER_AS_STRING";
    if ((SurvivorBotPerfDumpBots[0x15] & 0x10) == 0) {
      pcVar11 = "";
      if (*(char **)(SurvivorBotPerfDumpBots._28_4_ + 0x24) != (char *)0x0) {
        pcVar11 = *(char **)(SurvivorBotPerfDumpBots._28_4_ + 0x24);
      }
    }
    uVar3 = *(uint *)(this + 0x2ba0);
    if ((*pcVar11 == '\0') ||
       (((uVar3 < 4 && (sVar10 = strlen(pcVar11), uVar3 < sVar10)) &&
        (pcVar11 = strchr("+1Xx",(int)pcVar11[uVar3]), pcVar11 != (char *)0x0)))) {
      if (s_PerfCrawl_eState == 0) {
                    /* try { // try from 00943af5 to 00943bc5 has its CatchHandler @ 00943c6f */
        piVar12 = (int *)(**(code **)(*(int *)this + 0x9a4))(this);
        pfVar13 = (float *)(**(code **)(*piVar12 + 0xb8))(piVar12);
        fVar18 = SQRT((pfVar13[2] - (float)s_PerfCrawl_posLastPos._8_4_) *
                      (pfVar13[2] - (float)s_PerfCrawl_posLastPos._8_4_) +
                      (*pfVar13 - (float)s_PerfCrawl_posLastPos._0_4_) *
                      (*pfVar13 - (float)s_PerfCrawl_posLastPos._0_4_) +
                      (pfVar13[1] - (float)s_PerfCrawl_posLastPos._4_4_) *
                      (pfVar13[1] - (float)s_PerfCrawl_posLastPos._4_4_));
        if (*(float *)(SurvivorBotPerfCrawlDist._28_4_ + 0x2c) <= fVar18 &&
            fVar18 != *(float *)(SurvivorBotPerfCrawlDist._28_4_ + 0x2c)) {
          s_PerfCrawl_eState = 1;
          puVar14 = (undefined4 *)(**(code **)(*piVar12 + 0xb8))(piVar12);
          s_PerfCrawl_posLastPos._0_4_ = *puVar14;
          s_PerfCrawl_posLastPos._4_4_ = puVar14[1];
          s_PerfCrawl_posLastPos._8_4_ = puVar14[2];
          s_PerfCrawl_flLastTime = *(float *)(gpGlobals + 0xc);
          ConVar::SetValue(0x1011640);
        }
LAB_009436b0:
                    /* try { // try from 009436b3 to 009436b7 has its CatchHandler @ 00943c75 */
        NextBotPlayer<CTerrorPlayer>::PhysicsSimulate((NextBotPlayer<CTerrorPlayer> *)this);
        iVar5 = _DAT_0105db00;
        if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
           (iVar9 = ThreadGetCurrentId(), iVar5 == iVar9)) {
          cVar4 = CVProfNode::ExitScope();
          if (cVar4 != '\0') {
            _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
          }
          DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
        }
        if (local_78 == 0) {
          return;
        }
        (**(code **)(local_78 + 0x54))(local_78,local_80,local_7c,0,0,0);
        return;
      }
      if (s_PerfCrawl_eState != 1) goto LAB_009436b0;
      piVar12 = (int *)(**(code **)(*(int *)this + 0x9a4))(this);
      if (*(float *)(SurvivorBotPerfCrawlTime._28_4_ + 0x2c) + s_PerfCrawl_flLastTime <
          *(float *)(gpGlobals + 0xc)) {
        iVar5 = *(int *)(SurvivorBotPerfCrawlAng._28_4_ + 0x30);
        s_PerfCrawl_nLastAng = s_PerfCrawl_nLastAng + 1;
        if (iVar5 < s_PerfCrawl_nLastAng) {
          s_PerfCrawl_eState = 0;
                    /* try { // try from 00943664 to 009436ad has its CatchHandler @ 00943c42 */
          puVar14 = (undefined4 *)(**(code **)(*piVar12 + 0xb8))(piVar12);
          s_PerfCrawl_nLastAng = 0;
          s_PerfCrawl_posLastPos._0_4_ = *puVar14;
          s_PerfCrawl_posLastPos._4_4_ = puVar14[1];
          s_PerfCrawl_posLastPos._8_4_ = puVar14[2];
          ConVar::SetValue(0x1011640);
          goto LAB_009436b0;
        }
                    /* try { // try from 0094372d to 0094387f has its CatchHandler @ 00943c42 */
        s_PerfCrawl_flLastTime = *(float *)(gpGlobals + 0xc);
        pfVar13 = (float *)(**(code **)(*piVar12 + 0xb8))(piVar12);
        fVar18 = *pfVar13;
        fVar1 = pfVar13[1];
        fVar2 = pfVar13[2];
        pfVar13 = (float *)(**(code **)(*piVar12 + 0xbc))(piVar12);
        lVar17 = (longdouble)(6.2831855 / (float)iVar5);
        lVar16 = (longdouble)fcos(lVar17);
        lVar17 = (longdouble)fsin(lVar17);
        local_6c = pfVar13[2] * 100.0 + fVar2;
        local_74 = (undefined **)
                   (((float)lVar16 * *pfVar13 - (float)lVar17 * pfVar13[1]) * 100.0 + fVar18);
        local_70 = (pfVar13[1] * (float)lVar16 + *pfVar13 * (float)lVar17) * 100.0 + fVar1;
        (**(code **)(*piVar12 + 0xc0))
                  (piVar12,&local_74,3,
                   *(float *)(SurvivorBotPerfCrawlTime._28_4_ + 0x2c) +
                   *(float *)(SurvivorBotPerfCrawlTime._28_4_ + 0x2c),0,0,1,0x3e800000);
      }
                    /* try { // try from 00943885 to 009439ff has its CatchHandler @ 00943c75 */
      (**(code **)(*piVar12 + 0xa8))(piVar12);
      goto LAB_00943890;
    }
    if (*(int *)(SurvivorBotPerfDump._28_4_ + 0x30) == 0) goto LAB_009436b0;
  }
  else {
    iVar5 = *(int *)(SurvivorBotStop._28_4_ + 0x30);
joined_r0x00943303:
    if (iVar5 < 0) goto LAB_00943317;
LAB_00943305:
    if (*(float *)(gpGlobals + 0x10) == 0.0) goto LAB_00943317;
LAB_00943890:
    CBasePlayer::PhysicsSimulate((CBasePlayer *)this);
  }
  pCVar19 = (CBaseEntity *)this;
  cVar4 = CBasePlayer::HasQueuedUsercmds((CBasePlayer *)this);
  if (cVar4 == '\0') {
    local_74 = &PTR__CUserCmd_00c15058;
    local_3c = 0;
    local_70 = 0.0;
    local_6c = 0.0;
    local_68 = 0;
    local_64 = 0;
    local_60 = 0;
    local_5c = 0;
    local_58 = 0;
    local_54 = 0;
    local_50 = 0;
    local_4c = 0;
    local_48 = 0;
    local_44 = 0;
    local_40 = 0;
    local_3a = 0;
    local_38 = 0;
    local_34 = 0;
    local_30 = 0;
    local_2c = 0;
    local_28 = 0;
    local_24 = 0;
    local_20 = 0;
    puVar14 = (undefined4 *)(**(code **)(*(int *)this + 0x238))(this);
    _V_memset(&local_74,0,0x58);
    local_70 = *(float *)(gpGlobals + 0x18);
    local_5c = 0;
    local_58 = 0;
    local_54 = 0;
    local_50 = 0;
    local_4c = 0;
    local_68 = *puVar14;
    local_64 = puVar14[1];
    local_60 = puVar14[2];
    local_40 = (**(code **)(*random_valve + 8))(random_valve,0,0x7fffffff);
    (**(code **)(*(int *)this + 0x718))(this,&local_74,1,1,0,0);
    pCVar19 = (CBaseEntity *)this;
  }
LAB_00943317:
  iVar5 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar9 = ThreadGetCurrentId(pCVar19), iVar5 == iVar9)) {
    cVar4 = CVProfNode::ExitScope();
    if (cVar4 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_78 != 0) {
    (**(code **)(local_78 + 0x54))(local_78,local_80,local_7c,0,0,0);
  }
  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)