L L4D2node

CBaseProp::Spawn

0x007e9e90 · 1528 bytes · __thiscall

_ZN9CBaseProp5SpawnEv

Decompiled

undefined (1 param)

/* CBaseProp::Spawn() */

void __thiscall CBaseProp::Spawn(CBaseProp *this)

{
  float fVar1;
  code *pcVar2;
  undefined1 *puVar3;
  uint *puVar4;
  char cVar5;
  int *piVar6;
  int iVar7;
  int iVar8;
  undefined1 *puVar9;
  float *pfVar10;
  char *pcVar11;
  double dVar12;
  double dVar13;
  char *local_20 [4];
  
  pfVar10 = (float *)&stack0xffffffa4;
  if ((*(int *)(force_disablex360._28_4_ + 0x30) != 0) && (this[0x128] != (CBaseProp)0x0))
  goto LAB_007e9eb1;
  if (*(int *)(DisableDynamicPropLoading._28_4_ + 0x30) != 0) {
    piVar6 = (int *)(**(code **)(*(int *)this + 0x18))();
    (**(code **)(*piVar6 + 0x20))();
    pfVar10 = (float *)&stack0xffffffa0;
    pcVar11 = "";
    if (local_20[0] != (char *)0x0) {
      pcVar11 = local_20[0];
    }
    iVar7 = V_stristr(pcVar11,"door");
    if (iVar7 == 0) {
      UTIL_Remove((CBaseEntity *)this);
      Msg();
      return;
    }
  }
  iVar7 = *(int *)this;
  *pfVar10 = (float)local_20;
  pfVar10[1] = (float)this;
  pcVar2 = *(code **)(iVar7 + 0x20);
  pfVar10[-1] = 1.1628356e-38;
  (*pcVar2)();
  pcVar11 = "";
  if (local_20[0] != (char *)0x0) {
    pcVar11 = local_20[0];
  }
  if (*pcVar11 == '\0') {
    if (((byte)this[0x14d] & 8) == 0) {
      dVar13 = (double)*(float *)(this + 0x2e8);
    }
    else {
      pfVar10[-1] = (float)this;
      pfVar10[-2] = 1.1629051e-38;
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
      dVar13 = (double)*(float *)(this + 0x2e8);
      if (((byte)this[0x14d] & 8) != 0) {
        pfVar10[-1] = (float)this;
        pfVar10[-2] = 1.1629103e-38;
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
        dVar12 = (double)*(float *)(this + 0x2e4);
        if (((byte)this[0x14d] & 8) != 0) {
          pfVar10[-1] = (float)this;
          pfVar10[-2] = 1.1629169e-38;
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
        }
        goto LAB_007e9f57;
      }
    }
    dVar12 = (double)*(float *)(this + 0x2e4);
LAB_007e9f57:
    puVar3 = *(undefined1 **)(this + 0x7c);
    fVar1 = *(float *)(this + 0x2e0);
    *(double *)(pfVar10 + 5) = dVar13;
    *(double *)(pfVar10 + 3) = dVar12;
    *(double *)(pfVar10 + 1) = (double)fVar1;
    pfVar10[-1] = (float)"prop %s at %.0f %.0f %0.f missing modelname\n";
    puVar9 = &DAT_00d539c2;
    if (puVar3 != (undefined1 *)0x0) {
      puVar9 = puVar3;
    }
    *pfVar10 = (float)puVar9;
    pfVar10[-2] = 1.1628514e-38;
    Warning();
    UTIL_Remove((CBaseEntity *)this);
    return;
  }
  pfVar10[-1] = (float)pcVar11;
  pfVar10[-2] = 1.1628569e-38;
  CBaseEntity::PrecacheModel((char *)pfVar10[-1]);
  iVar7 = *(int *)this;
  pfVar10[-1] = (float)this;
  pcVar2 = *(code **)(iVar7 + 0x6c);
  pfVar10[-2] = 1.162858e-38;
  (*pcVar2)();
  iVar7 = *(int *)this;
  *pfVar10 = (float)pcVar11;
  pfVar10[-1] = (float)this;
  pcVar2 = *(code **)(iVar7 + 0x70);
  pfVar10[-2] = 1.1628597e-38;
  (*pcVar2)();
  pfVar10[-1] = (float)this;
  pfVar10[-2] = 1.1628608e-38;
  iVar8 = ParsePropData((CBaseProp *)pfVar10[-1]);
  iVar7 = *(int *)this;
  pfVar10[-1] = (float)this;
  pcVar2 = *(code **)(iVar7 + 0x3a8);
  pfVar10[-2] = 1.1628626e-38;
  cVar5 = (*pcVar2)();
  if (cVar5 != '\0') goto LAB_007ea090;
  if (iVar8 != 3) {
    if (iVar8 != 2) {
      if (iVar8 != 0) {
LAB_007ea090:
        pfVar10[1] = 0.0;
        *pfVar10 = -1.0;
        pfVar10[-1] = (float)this;
        pfVar10[-2] = 1.1628905e-38;
        CBaseEntity::SetNextThink((CBaseEntity *)pfVar10[-1],*pfVar10,(char *)pfVar10[1]);
        pfVar10[1] = 0.0;
        *pfVar10 = 9.80909e-45;
        pfVar10[-1] = (float)this;
        pfVar10[-2] = 1.1628939e-38;
        CBaseEntity::SetMoveType();
        if (this[0x105] != (CBaseProp)0x0) {
          iVar7 = *(int *)this;
          pfVar10[-1] = (float)this;
          *pfVar10 = (float)(this + 0x105);
          pcVar2 = *(code **)(iVar7 + 0x224);
          pfVar10[-2] = 1.1629574e-38;
          (*pcVar2)();
          this[0x105] = (CBaseProp)0x0;
        }
        fVar1 = *(float *)(gpGlobals + 0xc);
        if (fVar1 != *(float *)(this + 0x90)) {
          if (this[0x6c] == (CBaseProp)0x0) {
            puVar4 = *(uint **)(this + 0x30);
            if (puVar4 != (uint *)0x0) {
              *puVar4 = *puVar4 | 0x101;
              pfVar10[-1] = (float)puVar4;
              pfVar10[-2] = 1.1629509e-38;
              iVar7 = CBaseEdict::GetChangeAccessor((CBaseEdict *)pfVar10[-1]);
              *(undefined2 *)(iVar7 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CBaseProp)((byte)this[0x70] | 1);
          }
          *(float *)(this + 0x90) = fVar1;
        }
        if (*(float *)(this + 0x468) != 0.0) {
          if (this[0x6c] == (CBaseProp)0x0) {
            puVar4 = *(uint **)(this + 0x30);
            if (puVar4 != (uint *)0x0) {
              *puVar4 = *puVar4 | 0x101;
              pfVar10[-1] = (float)puVar4;
              pfVar10[-2] = 1.162965e-38;
              iVar7 = CBaseEdict::GetChangeAccessor((CBaseEdict *)pfVar10[-1]);
              *(undefined2 *)(iVar7 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CBaseProp)((byte)this[0x70] | 1);
          }
          *(undefined4 *)(this + 0x468) = 0;
        }
        if (*(float *)(this + 0x490) != 0.0) {
          if (this[0x6c] == (CBaseProp)0x0) {
            puVar4 = *(uint **)(this + 0x30);
            if (puVar4 != (uint *)0x0) {
              *puVar4 = *puVar4 | 0x101;
              pfVar10[-1] = (float)puVar4;
              pfVar10[-2] = 1.1629234e-38;
              iVar7 = CBaseEdict::GetChangeAccessor((CBaseEdict *)pfVar10[-1]);
              *(undefined2 *)(iVar7 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CBaseProp)((byte)this[0x70] | 1);
          }
          *(undefined4 *)(this + 0x490) = 0;
        }
        return;
      }
      pfVar10[2] = 0.0;
      pfVar10[1] = (float)&CPhysicsProp::typeinfo;
      *pfVar10 = (float)&typeinfo;
      pfVar10[-1] = (float)this;
      pfVar10[-2] = 1.1628723e-38;
      iVar7 = __dynamic_cast();
      if (iVar7 != 0) goto LAB_007ea090;
      if (((byte)this[0x14d] & 8) == 0) {
        dVar13 = (double)*(float *)(this + 0x2e8);
LAB_007ea042:
        dVar12 = (double)*(float *)(this + 0x2e4);
      }
      else {
        pfVar10[-1] = (float)this;
        pfVar10[-2] = 1.163029e-38;
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
        dVar13 = (double)*(float *)(this + 0x2e8);
        if (((byte)this[0x14d] & 8) == 0) goto LAB_007ea042;
        pfVar10[-1] = (float)this;
        pfVar10[-2] = 1.1630341e-38;
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
        dVar12 = (double)*(float *)(this + 0x2e4);
        if (((byte)this[0x14d] & 8) != 0) {
          pfVar10[-1] = (float)this;
          pfVar10[-2] = 1.16304e-38;
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
        }
      }
      puVar3 = *(undefined1 **)(this + 0x7c);
      fVar1 = *(float *)(this + 0x2e0);
      pfVar10[7] = (float)pcVar11;
      *(double *)(pfVar10 + 5) = dVar13;
      *(double *)(pfVar10 + 3) = dVar12;
      *(double *)(pfVar10 + 1) = (double)fVar1;
      puVar9 = &DAT_00d539c2;
      if (puVar3 != (undefined1 *)0x0) {
        puVar9 = puVar3;
      }
      pfVar10[-1] = (float)
                    "%s at %.0f %.0f %0.f uses model %s, which has propdata which means that it be used on a prop_physics. DELETED.\n"
      ;
      *pfVar10 = (float)puVar9;
      pfVar10[-2] = 1.1628864e-38;
      DevWarning((char *)pfVar10[-1]);
      goto LAB_007e9eb1;
    }
    if (*(char **)(this + 0x7c) != "prop_physics") {
      *pfVar10 = (float)"prop_physics";
      pfVar10[-1] = (float)this;
      pfVar10[-2] = 1.1629736e-38;
      cVar5 = CBaseEntity::ClassMatchesComplex((CBaseEntity *)pfVar10[-1],(char *)*pfVar10);
      if (cVar5 == '\0') goto LAB_007ea090;
    }
    if (((byte)this[0x14d] & 8) == 0) {
      dVar13 = (double)*(float *)(this + 0x2e8);
LAB_007ea319:
      dVar12 = (double)*(float *)(this + 0x2e4);
    }
    else {
      pfVar10[-1] = (float)this;
      pfVar10[-2] = 1.1630147e-38;
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
      dVar13 = (double)*(float *)(this + 0x2e8);
      if (((byte)this[0x14d] & 8) == 0) goto LAB_007ea319;
      pfVar10[-1] = (float)this;
      pfVar10[-2] = 1.1630199e-38;
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
      dVar12 = (double)*(float *)(this + 0x2e4);
      if (((byte)this[0x14d] & 8) != 0) {
        pfVar10[-1] = (float)this;
        pfVar10[-2] = 1.1630257e-38;
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
      }
    }
    puVar3 = *(undefined1 **)(this + 0x7c);
    fVar1 = *(float *)(this + 0x2e0);
    pfVar10[7] = (float)pcVar11;
    *(double *)(pfVar10 + 5) = dVar13;
    *(double *)(pfVar10 + 3) = dVar12;
    *(double *)(pfVar10 + 1) = (double)fVar1;
    puVar9 = &DAT_00d539c2;
    if (puVar3 != (undefined1 *)0x0) {
      puVar9 = puVar3;
    }
    pfVar10[-1] = (float)
                  "%s at %.0f %.0f %0.f uses model %s, which has no propdata which means it must be used on a prop_static. DELETED.\n"
    ;
    *pfVar10 = (float)puVar9;
    pfVar10[-2] = 1.1629883e-38;
    DevWarning((char *)pfVar10[-1]);
    goto LAB_007e9eb1;
  }
  if (((byte)this[0x14d] & 8) == 0) {
    dVar13 = (double)*(float *)(this + 0x2e8);
LAB_007ea1d8:
    dVar12 = (double)*(float *)(this + 0x2e4);
  }
  else {
    pfVar10[-1] = (float)this;
    pfVar10[-2] = 1.1630004e-38;
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
    dVar13 = (double)*(float *)(this + 0x2e8);
    if (((byte)this[0x14d] & 8) == 0) goto LAB_007ea1d8;
    pfVar10[-1] = (float)this;
    pfVar10[-2] = 1.1630056e-38;
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
    dVar12 = (double)*(float *)(this + 0x2e4);
    if (((byte)this[0x14d] & 8) != 0) {
      pfVar10[-1] = (float)this;
      pfVar10[-2] = 1.1630114e-38;
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)pfVar10[-1]);
    }
  }
  puVar3 = *(undefined1 **)(this + 0x7c);
  fVar1 = *(float *)(this + 0x2e0);
  pfVar10[7] = (float)pcVar11;
  *(double *)(pfVar10 + 5) = dVar13;
  *(double *)(pfVar10 + 3) = dVar12;
  *(double *)(pfVar10 + 1) = (double)fVar1;
  puVar9 = &DAT_00d539c2;
  if (puVar3 != (undefined1 *)0x0) {
    puVar9 = puVar3;
  }
  pfVar10[-1] = (float)
                "%s at %.0f %.0f %0.f uses model %s, which has an invalid prop_data type. DELETED.\n"
  ;
  *pfVar10 = (float)puVar9;
  pfVar10[-2] = 1.1629433e-38;
  DevWarning((char *)pfVar10[-1]);
LAB_007e9eb1:
  UTIL_Remove((CBaseEntity *)this);
  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)