L L4D2node

CFuncElevator::Spawn

0x006bd940 · 1696 bytes · __thiscall

_ZN13CFuncElevator5SpawnEv

Decompiled

undefined (1 param)

/* CFuncElevator::Spawn() */

void __thiscall CFuncElevator::Spawn(CFuncElevator *this)

{
  float fVar1;
  CBaseEntity CVar2;
  CFuncElevator CVar3;
  code *pcVar4;
  CBaseEdict *pCVar5;
  undefined1 *puVar6;
  CUtlVector<FloorInfo,CUtlMemory<FloorInfo,int>> *this_00;
  int *piVar7;
  int *piVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  char *pcVar12;
  CBaseEntity *this_01;
  undefined4 *puVar13;
  char *pcVar14;
  int iVar15;
  CBaseEntity *this_02;
  CFuncElevator *pCVar16;
  undefined4 uVar17;
  undefined4 uVar18;
  undefined4 uVar19;
  undefined4 uVar20;
  char local_49;
  undefined1 local_3c [12];
  undefined1 *local_30 [2];
  undefined4 local_28;
  undefined1 *local_24;
  undefined4 local_20;
  
  CBaseEntity::SetMoveType((CBaseEntity *)this,0xb,0);
  pcVar4 = *(code **)(*(int *)this + 0x70);
  (**(code **)(*(int *)this + 0x20))(local_30,this);
  puVar6 = &DAT_00d539c2;
  if (local_30[0] != (undefined1 *)0x0) {
    puVar6 = local_30[0];
  }
  (*pcVar4)(this,puVar6);
  *(undefined4 *)(this + 0xd8) = 0;
  *(undefined4 *)(this + 0xdc) = 0;
  (**(code **)(*(int *)this + 0x6c))(this);
  CBaseEntity::AddFlag((CBaseEntity *)this,0x1000);
  CCollisionProperty::SetSolid((CCollisionProperty *)(this + 0x194),1);
  if ((*(float *)(this + 0x4e8) == 0.0) && (fVar1 = *(float *)(this + 0x4e4), fVar1 != 0.0)) {
    if (this[0x6c] == (CFuncElevator)0x0) {
      pCVar5 = *(CBaseEdict **)(this + 0x30);
      if (pCVar5 != (CBaseEdict *)0x0) {
        *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
      *(float *)(this + 0x4e8) = fVar1;
    }
    else {
      this[0x70] = (CFuncElevator)((byte)this[0x70] | 1);
      *(float *)(this + 0x4e8) = fVar1;
    }
  }
  local_20 = 0xffffffff;
  local_28 = *(undefined4 *)(this + 0x4e0);
  this[0x508] = (CFuncElevator)0x1;
  *(undefined4 *)(this + 0x54c) = 0;
  AllocPooledString((char *)local_30);
  local_24 = local_30[0];
  this_00 = (CUtlVector<FloorInfo,CUtlMemory<FloorInfo,int>> *)(this + 0x540);
  CUtlVector<FloorInfo,CUtlMemory<FloorInfo,int>>::InsertBefore(this_00,0,(FloorInfo *)&local_28);
  local_20 = 0xffffffff;
  local_28 = *(undefined4 *)(this + 0x4d4);
  AllocPooledString((char *)local_30);
  local_24 = local_30[0];
  CUtlVector<FloorInfo,CUtlMemory<FloorInfo,int>>::InsertBefore
            (this_00,*(int *)(this + 0x54c),(FloorInfo *)&local_28);
  uVar17 = *(undefined4 *)(this + 0x154);
  this_02 = (CBaseEntity *)0x0;
LAB_006bdacb:
  this_02 = (CBaseEntity *)
            CGlobalEntityList::FindEntityByOutputTarget
                      ((CGlobalEntityList *)gEntList,this_02,uVar17);
  if (this_02 == (CBaseEntity *)0x0) {
    CUtlVector<FloorInfo,CUtlMemory<FloorInfo,int>>::Sort(this_00,FloorHeightSort);
    fVar1 = *(float *)(gpGlobals + 0xc);
    if (fVar1 != *(float *)(this + 0x4ec)) {
      if (this[0x6c] == (CFuncElevator)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CFuncElevator)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x4ec) = fVar1;
    }
    fVar1 = *(float *)(this + 0x500);
    *(undefined4 *)(this + 0x50c) = 0xbf800000;
    if (fVar1 == *(float *)(this + 0x4f0)) {
      CVar3 = this[0x14d];
    }
    else {
      if (this[0x6c] == (CFuncElevator)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CFuncElevator)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x4f0) = fVar1;
      CVar3 = this[0x14d];
    }
    if (((byte)CVar3 & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    fVar1 = *(float *)(this + 0x2e8);
    if (fVar1 != *(float *)(this + 0x4f4)) {
      if (this[0x6c] == (CFuncElevator)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CFuncElevator)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x4f4) = fVar1;
    }
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    fVar1 = *(float *)(this + 0x2e8);
    if (fVar1 != *(float *)(this + 0x4f8)) {
      if (this[0x6c] == (CFuncElevator)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CFuncElevator)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x4f8) = fVar1;
    }
    uVar20 = 0;
    uVar19 = 0;
    uVar17 = 0;
    uVar18 = 0;
    pCVar16 = this;
    CBaseEntity::ThinkSet((_func_void *)local_3c,(float)this,(char *)0x0);
    *(undefined4 *)(this + 0x504) = 0xffffffff;
    if (this[0x4fc] != (CFuncElevator)0x0) {
      if (this[0x6c] == (CFuncElevator)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CFuncElevator)((byte)this[0x70] | 1);
      }
      this[0x4fc] = (CFuncElevator)0x0;
    }
    (**(code **)(*(int *)this + 0x290))(this,pCVar16,uVar17,uVar18,uVar19,uVar20);
    return;
  }
  for (piVar7 = (int *)(**(code **)(*(int *)this_02 + 0x30))(this_02); piVar7 != (int *)0x0;
      piVar7 = (int *)piVar7[3]) {
    iVar11 = piVar7[1];
    iVar15 = 0;
    if (0 < iVar11) {
      do {
        piVar8 = (int *)(iVar15 * 0x40 + *piVar7);
        if (((*piVar8 == 0xb) && ((*(byte *)((int)piVar8 + 0xe) & 0x10) != 0)) &&
           (iVar9 = CBaseEntityOutput::GetActionForTarget
                              ((CBaseEntityOutput *)(this_02 + piVar8[2]),
                               *(undefined4 *)(this + 0x154)), iVar9 != 0)) {
          pcVar14 = *(char **)(iVar9 + 4);
          if (pcVar14 == (char *)0x0) {
            pcVar14 = "";
LAB_006bdb62:
            iVar10 = _V_stricmp(pcVar14,"MoveToFloor");
            if (iVar10 != 0) goto LAB_006bdb10;
          }
          else if (pcVar14 != "MoveToFloor") goto LAB_006bdb62;
          pcVar14 = *(char **)(iVar9 + 8);
          if (pcVar14 != (char *)0x0) {
            if (*(char **)(this_02 + 0x7c) == "func_button*") {
              local_49 = '\x01';
            }
            else {
              local_49 = CBaseEntity::ClassMatchesComplex(this_02,"func_button*");
              pcVar14 = *(char **)(iVar9 + 8);
            }
            if (*(int *)(this + 0x54c) < 1) goto LAB_006bdc07;
            iVar11 = *(int *)(this + 0x540);
            if (*(char **)(iVar11 + 4) == pcVar14) goto LAB_006bdce7;
            iVar10 = 0;
            iVar15 = iVar11;
            goto LAB_006bdbfc;
          }
        }
LAB_006bdb10:
        iVar15 = iVar15 + 1;
      } while (iVar15 != iVar11);
    }
  }
  goto LAB_006bdca8;
  while (piVar7 = (int *)(iVar15 + 0x10), iVar15 = iVar11, (char *)*piVar7 != pcVar14) {
LAB_006bdbfc:
    iVar11 = iVar15 + 0xc;
    iVar10 = iVar10 + 1;
    if (iVar10 == *(int *)(this + 0x54c)) goto LAB_006bdc07;
  }
LAB_006bdce7:
  if (local_49 != '\0') {
    puVar13 = (undefined4 *)(**(code **)(*(int *)this_02 + 0xc))(this_02);
    *(undefined4 *)(iVar11 + 8) = *puVar13;
  }
LAB_006bdca8:
  uVar17 = *(undefined4 *)(this + 0x154);
  goto LAB_006bdacb;
LAB_006bdc07:
  pcVar12 = "";
  if (pcVar14 != (char *)0x0) {
    pcVar12 = pcVar14;
  }
  this_01 = (CBaseEntity *)
            CGlobalEntityList::FindEntityByName
                      ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,pcVar12,(CBaseEntity *)0x0,
                       (CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
  if (this_01 != (CBaseEntity *)0x0) {
    if (local_49 == '\0') {
      CVar2 = this_01[0x14d];
      local_20 = 0xffffffff;
    }
    else {
      puVar13 = (undefined4 *)(**(code **)(*(int *)this_02 + 0xc))(this_02);
      CVar2 = this_01[0x14d];
      local_20 = *puVar13;
    }
    if (((byte)CVar2 & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this_01);
    }
    local_24 = *(undefined1 **)(iVar9 + 8);
    local_28 = *(undefined4 *)(this_01 + 0x2e8);
    CUtlVector<FloorInfo,CUtlMemory<FloorInfo,int>>::InsertBefore
              (this_00,*(int *)(this + 0x54c),(FloorInfo *)&local_28);
  }
  goto LAB_006bdca8;
}

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)