L L4D2node

SpawnVIPGnome

0x008a0a80 · 1540 bytes · unknown

_ZL13SpawnVIPGnomev

Decompiled

undefined (0 params)

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* SpawnVIPGnome() */

void SpawnVIPGnome(void)

{
  CNavArea *this;
  bool bVar1;
  int *piVar2;
  int *piVar3;
  float *pfVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  float *local_114;
  Vector *local_110;
  float local_10c;
  float local_108;
  float local_104;
  float local_100;
  float local_fc;
  float local_f8;
  CTraceFilterSimple local_f4 [16];
  NavAreaCollector local_e4 [4];
  int local_e0 [5];
  float local_cc;
  float local_c8;
  float local_c4;
  undefined4 local_bc;
  undefined4 local_b8;
  undefined4 local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  CNavArea *local_70;
  float local_6c;
  float local_68;
  Vector local_64 [32];
  float local_44;
  char local_3a;
  char local_39;
  int local_24;
  
  piVar2 = (int *)CreateEntityByName("weapon_gnome",-1,true);
  if (piVar2 == (int *)0x0) {
    return;
  }
  (**(code **)(*piVar2 + 100))(piVar2);
  local_10c = vec3_origin;
  local_108 = DAT_01053d4c;
  local_104 = DAT_01053d50;
  GetPlayerSpawnPosition(8,(Vector *)&local_10c,0,0);
  if (((vec3_origin == local_10c) && (DAT_01053d4c == local_108)) && (DAT_01053d50 == local_104)) {
    return;
  }
  piVar3 = (int *)CGlobalEntityList::FindEntityByClassnameNearest
                            ((CGlobalEntityList *)gEntList,"weapon_melee_spawn",(Vector *)&local_10c
                             ,600.0);
  if (piVar3 == (int *)0x0) {
    piVar3 = (int *)CGlobalEntityList::FindEntityByClassnameNearest
                              ((CGlobalEntityList *)gEntList,"weapon_ammo_spawn",
                               (Vector *)&local_10c,600.0);
    if ((piVar3 == (int *)0x0) &&
       (piVar3 = (int *)CGlobalEntityList::FindEntityByClassnameNearest
                                  ((CGlobalEntityList *)gEntList,"weapon_first_aid_kit_spawn",
                                   (Vector *)&local_10c,600.0), piVar3 == (int *)0x0)) {
      bVar1 = true;
      goto LAB_008a0b71;
    }
    bVar1 = true;
  }
  else {
    bVar1 = false;
  }
  pfVar4 = (float *)(**(code **)(*piVar3 + 0x288))(piVar3);
  local_108 = pfVar4[1];
  local_10c = *pfVar4;
  local_104 = pfVar4[2];
LAB_008a0b71:
  if (((local_10c != vec3_origin) || (DAT_01053d4c != local_108)) || (DAT_01053d50 != local_104)) {
    if (bVar1) {
      local_70 = (CNavArea *)
                 CNavMesh::GetNearestNavArea
                           (TheNavMesh,(Vector *)&local_10c,true,10000.0,false,true,false);
      if (local_70 == (CNavArea *)0x0) {
        return;
      }
      local_e0[0] = 0;
      local_e0[1] = 0;
      local_e0[2] = 0;
      local_e0[3] = 0;
      local_e0[4] = 0;
      local_e4[0] = (NavAreaCollector)0x0;
                    /* try { // try from 008a0d6c to 008a0d9c has its CatchHandler @ 008a1092 */
      SearchSurroundingAreas<NavAreaCollector>
                (local_70,(Vector *)(local_70 + 0x2c),local_e4,1000.0,0,-1);
      CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)local_e0,0,&local_70);
      iVar6 = 0;
      iVar5 = local_e0[3];
      if (0 < local_e0[3]) {
        do {
          local_110 = (Vector *)&local_70;
          this = *(CNavArea **)(local_e0[0] + iVar6 * 4);
          if ((this != (CNavArea *)0x0) && (((byte)this[0x12d] & 8) != 0)) {
                    /* try { // try from 008a0de2 to 008a0f38 has its CatchHandler @ 008a10c8 */
            CNavArea::GetClosestPointOnArea(this,(Vector *)&local_10c,(Vector *)&local_100);
            local_c4 = local_f8 + 37.0;
            local_cc = local_100;
            local_bc = 0;
            local_b8 = 0;
            local_b4 = 0;
            local_8c = 0;
            local_87 = 0;
            local_9c = 0x41000000;
            local_98 = 0x41000000;
            local_94 = 0x42100000;
            local_88 = 0;
            local_ac = 0;
            local_a8 = 0;
            local_c8 = local_fc;
            local_a4 = 0xc2100000;
            CTraceFilterSimple::CTraceFilterSimple
                      (local_f4,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
            (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x200400b,local_f4,local_110);
            if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
              DebugDrawLine(local_110,local_64,0xff,0xff,0,true,-1.0);
            }
            iVar5 = local_e0[3];
            if ((((local_44 == 1.0) && (local_3a == '\0')) && (local_39 == '\0')) && (local_24 == 0)
               ) {
              local_cc = local_100;
              local_c8 = local_fc;
              local_c4 = local_f8;
              break;
            }
          }
          iVar6 = iVar6 + 1;
        } while (iVar6 < iVar5);
      }
      if (iVar6 == iVar5) {
        local_cc = local_10c;
        local_c8 = local_108;
        local_c4 = local_104;
      }
      local_e0[3] = 0;
      CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)local_e0);
      local_e0[4] = local_e0[0];
      CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)local_e0);
    }
    else {
      local_c8 = local_108;
      local_c4 = local_104;
      local_cc = local_10c;
    }
    local_114 = &local_cc;
    local_110 = (Vector *)&local_70;
    local_c4 = local_c4 + 32.0;
    iVar5 = rand();
    iVar6 = rand();
    iVar7 = rand();
    local_70 = (CNavArea *)((float)iVar5 * 0.010986663 - 180.0);
    local_6c = (float)iVar6 * 0.010986663 - 180.0;
    local_68 = (float)iVar7 * 0.010986663 - 180.0;
    (**(code **)(*piVar2 + 0x1dc))(piVar2,local_114,local_110,&vec3_origin);
  }
  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)