L L4D2node

TerrorNavMesh::OnDoorCreated

0x00973430 · 1157 bytes · __thiscall

_ZN13TerrorNavMesh13OnDoorCreatedEP11CBaseEntity

Decompiled

undefined (2 params)

/* TerrorNavMesh::OnDoorCreated(CBaseEntity*) */

void __thiscall TerrorNavMesh::OnDoorCreated(TerrorNavMesh *this,CBaseEntity *param_1)

{
  undefined4 uVar1;
  CNavArea *this_00;
  CBaseEntity *this_01;
  int iVar2;
  undefined4 *puVar3;
  int *piVar4;
  int iVar5;
  float fVar6;
  int local_70;
  int local_6c;
  int local_68;
  int local_64;
  int local_60;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  float local_4c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  if (param_1 != (CBaseEntity *)0x0) {
    this_01 = (CBaseEntity *)__dynamic_cast(param_1,&CBaseEntity::typeinfo,&CBaseDoor::typeinfo,0);
    if (this_01 == (CBaseEntity *)0x0) {
      piVar4 = (int *)__dynamic_cast(param_1,&CBaseEntity::typeinfo,&CBasePropDoor::typeinfo,0);
      if (piVar4 == (int *)0x0) {
        return;
      }
      (**(code **)(*piVar4 + 0x49c))(piVar4,&local_4c,2);
      if (local_40 < local_4c) {
        local_40 = local_4c;
      }
      if (local_3c < local_48) {
        local_3c = local_48;
      }
      fVar6 = local_44;
      if (local_44 <= local_38) {
        fVar6 = local_38;
      }
      if (local_40 < local_4c) {
        local_4c = local_40;
      }
      if (local_3c < local_48) {
        local_48 = local_3c;
      }
      local_38 = fVar6;
      if (local_44 <= fVar6) {
        fVar6 = local_44;
      }
    }
    else {
      local_58 = *(undefined4 *)(this_01 + 0x3a8);
      local_54 = *(undefined4 *)(this_01 + 0x3ac);
      local_50 = *(undefined4 *)(this_01 + 0x3b0);
      local_34 = *(float *)(this_01 + 0x39c);
      local_30 = *(float *)(this_01 + 0x3a0);
      local_2c = *(float *)(this_01 + 0x3a4);
      uVar1 = *(undefined4 *)(this_01 + 0x440);
      (**(code **)(*(int *)this_01 + 0x32c))(this_01,1);
      CCollisionProperty::CollisionAABBToWorldAABB
                ((CCollisionProperty *)(param_1 + 0x194),(Vector *)(param_1 + 0x19c),
                 (Vector *)(param_1 + 0x1a8),(Vector *)&local_4c,(Vector *)&local_40);
      (**(code **)(*(int *)this_01 + 0x32c))(this_01,uVar1);
      CBaseEntity::SetLocalOrigin(this_01,(Vector *)&local_34);
      CBaseEntity::SetLocalAngles(this_01,(QAngle *)&local_58);
      fVar6 = local_44;
    }
    local_44 = fVar6;
    local_38 = local_38 - 18.0;
    local_44 = local_44 - 18.0;
    if (*(int *)(this + 0x18) != 0) {
      if ((CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
           searchMarker == '\0') &&
         (iVar2 = __cxa_guard_acquire(&CNavMesh::
                                       ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)
                                       ::searchMarker), iVar2 != 0)) {
                    /* try { // try from 0097383c to 00973840 has its CatchHandler @ 009738b5 */
        CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::searchMarker
             = RandomInt(0,0x100000);
        __cxa_guard_release(&CNavMesh::
                             ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
                             searchMarker);
      }
      iVar2 = CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
              searchMarker + 1;
      if (CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
          searchMarker + 1 == 0) {
        iVar2 = CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
                searchMarker + 2;
      }
      CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::searchMarker =
           iVar2;
      fVar6 = 1.0 / *(float *)(this + 0x20);
      iVar2 = (int)((local_4c - *(float *)(this + 0x2c)) * fVar6);
      if (iVar2 < 0) {
        local_64 = 0;
      }
      else {
        local_64 = *(int *)(this + 0x24) + -1;
        if (iVar2 < *(int *)(this + 0x24)) {
          local_64 = iVar2;
        }
      }
      iVar2 = (int)((local_40 - *(float *)(this + 0x2c)) * fVar6);
      if (iVar2 < 0) {
        local_6c = 0;
      }
      else {
        local_6c = *(int *)(this + 0x24) + -1;
        if (iVar2 < *(int *)(this + 0x24)) {
          local_6c = iVar2;
        }
      }
      iVar2 = (int)((local_48 - *(float *)(this + 0x30)) * fVar6);
      if (iVar2 < 0) {
        local_70 = 0;
      }
      else {
        local_70 = *(int *)(this + 0x28) + -1;
        if (iVar2 < *(int *)(this + 0x28)) {
          local_70 = iVar2;
        }
      }
      iVar2 = (int)((local_3c - *(float *)(this + 0x30)) * fVar6);
      if (iVar2 < 0) {
        local_68 = 0;
      }
      else {
        local_68 = *(int *)(this + 0x28) + -1;
        if (iVar2 < *(int *)(this + 0x28)) {
          local_68 = iVar2;
        }
      }
      for (; local_64 <= local_6c; local_64 = local_64 + 1) {
        if (local_70 <= local_68) {
          iVar2 = local_70 * *(int *)(this + 0x24) + local_64;
          if (*(int *)(this + 0x18) <= iVar2) {
LAB_00973752:
            if (9 < CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
                    __executeCount) {
              return;
            }
            CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
            __executeCount =
                 CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
                 __executeCount + 1;
            Warning("** Walked off of the CNavMesh::m_grid in ForAllAreasOverlappingExtent()\n");
            return;
          }
          local_60 = local_70;
          while( true ) {
            iVar5 = 0;
            piVar4 = (int *)(*(int *)(this + 0xc) + iVar2 * 0x14);
            if (0 < piVar4[3]) {
              do {
                this_00 = *(CNavArea **)(*piVar4 + iVar5 * 4);
                if (*(int *)(this_00 + 0x74) !=
                    CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)::
                    searchMarker) {
                  *(int *)(this_00 + 0x74) =
                       CNavMesh::ForAllAreasOverlappingExtent<DoorSetter>(DoorSetter&,Extent_const&)
                       ::searchMarker;
                  CNavArea::GetExtent(this_00,(Extent *)&local_34);
                  if ((((local_4c <= local_28) && (local_34 <= local_40)) && (local_48 <= local_24))
                     && (((local_30 <= local_3c && (local_44 <= local_20)) && (local_2c <= local_38)
                         ))) {
                    puVar3 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
                    uVar1 = *puVar3;
                    *(uint *)(this_00 + 300) = *(uint *)(this_00 + 300) | 0x40000;
                    *(undefined4 *)(this_00 + 0x174) = uVar1;
                  }
                }
                iVar5 = iVar5 + 1;
              } while (iVar5 < piVar4[3]);
            }
            local_60 = local_60 + 1;
            if (local_68 < local_60) break;
            iVar2 = local_60 * *(int *)(this + 0x24) + local_64;
            if (*(int *)(this + 0x18) <= iVar2) goto LAB_00973752;
          }
        }
      }
    }
  }
  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)