L L4D2node

SurvivorLegsMoveUp::OnStart

0x00957060 · 2047 bytes · __thiscall

_ZN18SurvivorLegsMoveUp7OnStartEP11SurvivorBotP6ActionIS0_E

Decompiled

undefined (3 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SurvivorLegsMoveUp::OnStart(SurvivorBot*, Action<SurvivorBot>*) */

SurvivorLegsMoveUp * __thiscall
SurvivorLegsMoveUp::OnStart(SurvivorLegsMoveUp *this,SurvivorBot *param_1,Action *param_2)

{
  INextBot *pIVar1;
  Vector *pVVar2;
  uint *puVar3;
  CNavArea CVar4;
  bool bVar5;
  char cVar6;
  int iVar7;
  undefined4 *puVar8;
  int *piVar9;
  CNavArea *pCVar10;
  int iVar11;
  Path *this_00;
  Vector *pVVar12;
  CNavArea *pCVar13;
  undefined *puVar14;
  uint uVar15;
  SurvivorBot *pSVar16;
  CBaseEntity *pCVar17;
  longdouble lVar18;
  int local_9c;
  CNavArea *local_80;
  undefined4 local_7c;
  undefined4 local_78;
  undefined4 local_70;
  undefined4 local_6c;
  int local_68;
  float local_64;
  float local_60;
  float local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined **local_4c;
  INextBot *local_48;
  undefined4 local_44;
  undefined1 local_40;
  undefined1 local_3f;
  Action *local_3c;
  undefined4 local_38;
  undefined4 local_34;
  int local_30 [8];
  
  iVar7 = SurvivorBot::GetTeamSituation((SurvivorBot *)param_2);
  uVar15 = *(uint *)(iVar7 + 0x50);
  if ((((uVar15 == 0xffffffff) ||
       (puVar14 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar14 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar14 + 8) != uVar15 >> 0xc)) ||
     (piVar9 = *(int **)(puVar14 + 4), piVar9 == (int *)0x0)) {
    *(undefined4 *)this = 3;
    *(undefined4 *)(this + 4) = 0;
    *(char **)(this + 8) = "No friend";
    return this;
  }
  puVar8 = (undefined4 *)(**(code **)(*piVar9 + 0xc))(piVar9);
  local_30[0] = 0;
  local_30[1] = 0;
  local_30[2] = 0;
  local_30[3] = 0;
  *(undefined4 *)(param_1 + 0x34) = *puVar8;
  local_30[4] = 0;
  local_3c = param_2;
  local_38 = 0x43960000;
                    /* try { // try from 00957119 to 0095711e has its CatchHandler @ 009578bc */
  local_34 = (**(code **)(*(int *)param_2 + 0x9ac))(param_2);
  uVar15 = *(uint *)(iVar7 + 0x50);
  pCVar17 = (CBaseEntity *)0x0;
  if (uVar15 != 0xffffffff) {
    puVar14 = g_pEntityList + (uVar15 & 0xfff) * 0x10;
    if ((puVar14 != (undefined *)0xfffffffc) && (*(uint *)(puVar14 + 8) == uVar15 >> 0xc)) {
      pCVar17 = *(CBaseEntity **)(puVar14 + 4);
    }
  }
  if (((byte)pCVar17[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(pCVar17);
    uVar15 = *(uint *)(iVar7 + 0x50);
  }
  piVar9 = (int *)0x0;
  if (((uVar15 != 0xffffffff) &&
      (puVar14 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar14 + 8) == uVar15 >> 0xc)) {
    piVar9 = *(int **)(puVar14 + 4);
  }
                    /* try { // try from 009571a7 to 00957349 has its CatchHandler @ 009578c4 */
  pCVar10 = (CNavArea *)(**(code **)(*piVar9 + 0x52c))(piVar9);
  SearchSurroundingAreas<SpotFinder>
            (pCVar10,(Vector *)(pCVar17 + 0x2e0),(SpotFinder *)&local_3c,300.0,0,-1);
  if (local_30[3] == 0) {
    *(undefined4 *)this = 3;
    *(undefined4 *)(this + 4) = 0;
    *(char **)(this + 8) = "Can\'t find a spot to move up to";
    goto LAB_009571f6;
  }
  iVar7 = RandomInt(0,local_30[3] + -1);
  local_4c = &PTR_operator___00d09770;
  pIVar1 = (INextBot *)(param_2 + 0x4028);
  local_48 = pIVar1;
  local_44 = (**(code **)(*(int *)(param_2 + 0x4028) + 0xc0))(pIVar1);
  piVar9 = (int *)(**(code **)(*(int *)(param_2 + 0x4028) + 200))(pIVar1);
  iVar11 = (**(code **)(*piVar9 + 0xb8))(piVar9,pIVar1);
  local_40 = iVar11 != 0;
  local_3f = 0;
  local_7c = 0;
  pVVar2 = (Vector *)(local_30[0] + iVar7 * 0xc);
  local_78 = 0;
  this_00 = (Path *)(param_1 + 0x38);
  if (_towlower == 0) {
    local_68 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_7c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x113,
               &Path::
                Compute<SurvivorBotPathCost>(INextBot*,Vector_const&,SurvivorBotPathCost&,float)::
                tm_fmt,"(%s)%s","NextBotSpiky","Path::Compute(goal)");
    local_68 = _towlower;
  }
  iVar7 = _DAT_0105db00;
  local_70 = local_7c;
  local_6c = local_78;
  if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 00957378 to 0095737c has its CatchHandler @ 009578c0 */
    iVar11 = ThreadGetCurrentId();
    if (iVar7 == iVar11) {
      if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
                    /* try { // try from 009577e0 to 00957803 has its CatchHandler @ 009578c0 */
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1b7,(char *)0x0,0xbfa1cb);
      }
      puVar3 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
      *puVar3 = *puVar3 | 4;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
  }
                    /* try { // try from 00957394 to 009576a7 has its CatchHandler @ 00957890 */
  (**(code **)(*(int *)(param_1 + 0x38) + 0x48))(this_00);
  pVVar12 = (Vector *)(**(code **)(*(int *)(param_2 + 0x4028) + 0xd4))(pIVar1);
  piVar9 = (int *)(**(code **)(*(int *)(param_2 + 0x4028) + 0xb4))(pIVar1);
  pCVar10 = (CNavArea *)(**(code **)(*piVar9 + 0x52c))(piVar9);
  if (pCVar10 == (CNavArea *)0x0) {
                    /* try { // try from 00957860 to 0095788a has its CatchHandler @ 00957890 */
    (**(code **)(*(int *)(param_1 + 0x38) + 100))(this_00,pIVar1,2);
  }
  else {
    pCVar13 = (CNavArea *)CNavMesh::GetNearestNavArea(TheNavMesh,pVVar2,true,200.0,true,true,false);
    if (pCVar10 == pCVar13) {
LAB_00957789:
      Path::BuildTrivialPath(this_00,pIVar1,pVVar2);
    }
    else {
      local_64 = *(float *)pVVar2;
      local_60 = *(float *)(pVVar2 + 4);
      local_5c = *(float *)(pVVar2 + 8);
      if (pCVar13 == (CNavArea *)0x0) {
        CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_64,&local_5c,(Vector *)0x0);
      }
      else {
        lVar18 = (longdouble)CNavArea::GetZ(pCVar13,local_64,local_60);
        local_5c = (float)lVar18;
      }
      pCVar17 = (CBaseEntity *)(**(code **)(*(int *)(param_2 + 0x4028) + 0xb4))(pIVar1);
      if (((byte)pCVar17[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar17);
      }
      local_58 = *(undefined4 *)(pCVar17 + 0x2e0);
      local_80 = (CNavArea *)0x0;
      local_54 = *(undefined4 *)(pCVar17 + 0x2e4);
      local_50 = *(undefined4 *)(pCVar17 + 0x2e8);
      pCVar17 = (CBaseEntity *)(**(code **)(*(int *)(param_2 + 0x4028) + 0xb4))(pIVar1);
      iVar7 = CBaseEntity::GetTeamNumber(pCVar17);
      bVar5 = NavAreaBuildPath<SurvivorBotPathCost>
                        (pCVar10,pCVar13,(Vector *)&local_58,pVVar2,(SurvivorBotPathCost *)&local_4c
                         ,&local_80,0.0,iVar7,false);
      if (local_80 != (CNavArea *)0x0) {
        if (pCVar10 == local_80) goto LAB_00957789;
        local_9c = 1;
        pCVar13 = local_80;
        do {
          pCVar13 = *(CNavArea **)(pCVar13 + 0x78);
          if (pCVar13 == (CNavArea *)0x0) break;
          local_9c = local_9c + 1;
        } while (pCVar10 != pCVar13);
        if (local_9c < 0x100) {
          if (local_9c == 1) goto LAB_00957789;
          *(int *)(param_1 + 0x443c) = local_9c;
        }
        else {
          local_9c = 0xff;
          *(undefined4 *)(param_1 + 0x443c) = 0xff;
        }
        pCVar10 = local_80;
        iVar7 = local_9c;
        pSVar16 = param_1 + (local_9c + -1) * 0x44 + 0x3c;
        do {
          *(CNavArea **)pSVar16 = pCVar10;
          iVar7 = iVar7 + -1;
          CVar4 = pCVar10[0x7c];
          *(undefined4 *)(pSVar16 + 0x18) = 0;
          *(uint *)(pSVar16 + 4) = (byte)CVar4 & 0xf;
          pCVar10 = *(CNavArea **)(pCVar10 + 0x78);
          if (pCVar10 == (CNavArea *)0x0) break;
          pSVar16 = pSVar16 + -0x44;
        } while (iVar7 != 0);
        local_9c = local_9c * 0x44;
        *(CNavArea **)(param_1 + local_9c + 0x3c) = local_80;
        *(float *)(this_00 + local_9c + 0xc) = local_64;
        *(float *)(this_00 + local_9c + 0x10) = local_60;
        *(float *)(this_00 + local_9c + 0x14) = local_5c;
        iVar7 = *(int *)(param_1 + 0x443c);
        *(undefined4 *)(param_1 + iVar7 * 0x44 + 0x50) = 0;
        *(undefined4 *)(param_1 + iVar7 * 0x44 + 0x40) = 9;
        *(undefined4 *)(param_1 + iVar7 * 0x44 + 0x54) = 0;
        *(int *)(param_1 + 0x443c) = iVar7 + 1;
        cVar6 = Path::ComputePathDetails(this_00,pIVar1,pVVar12);
        if (cVar6 == '\0') {
          (**(code **)(*(int *)(param_1 + 0x38) + 0x48))(this_00);
          (**(code **)(*(int *)(param_1 + 0x38) + 100))(this_00,pIVar1,2);
        }
        else {
                    /* try { // try from 00957756 to 009577aa has its CatchHandler @ 00957890 */
          Path::Optimize((INextBot *)this_00);
          Path::PostProcess(this_00);
          (**(code **)(*(int *)(param_1 + 0x38) + 100))(this_00,pIVar1,!bVar5);
        }
      }
    }
  }
  iVar7 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    iVar11 = ThreadGetCurrentId();
    if (iVar7 == iVar11) {
      cVar6 = CVProfNode::ExitScope();
      if (cVar6 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  if (local_68 != 0) {
    (**(code **)(local_68 + 0x54))(local_68,local_70,local_6c,0,0,0);
  }
  *(undefined4 *)this = 0;
  *(undefined4 *)(this + 4) = 0;
  *(undefined4 *)(this + 8) = 0;
LAB_009571f6:
  local_30[3] = 0;
  CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)local_30);
  local_30[4] = local_30[0];
  CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)local_30);
  return this;
}

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)