L L4D2node

SavedPropPhysics::PreSpawn

0x00867740 · 576 bytes · __thiscall

_ZN16SavedPropPhysics8PreSpawnEP11CBaseEntity

Decompiled

undefined (2 params)

/* SavedPropPhysics::PreSpawn(CBaseEntity*) */

void __thiscall SavedPropPhysics::PreSpawn(SavedPropPhysics *this,CBaseEntity *param_1)

{
  CBaseEdict *this_00;
  char *pcVar1;
  undefined4 uVar2;
  undefined1 *puVar3;
  int iVar4;
  int iVar5;
  int in_GS_OFFSET;
  undefined4 *puVar6;
  undefined4 *puVar7;
  undefined1 *local_40 [4];
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  Color local_24;
  undefined1 local_23;
  undefined1 local_22;
  undefined1 local_21;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar1 = (char *)KeyValues::GetString(*(KeyValues **)(this + 4),"pos","");
  local_30 = vec3_origin;
  local_28 = DAT_01053d50;
  puVar7 = &local_2c;
  local_2c = DAT_01053d4c;
  puVar6 = &local_28;
  sscanf(pcVar1,"%f %f %f",(Vector *)&local_30,puVar7,puVar6,puVar6,puVar7);
  CBaseEntity::SetAbsOrigin(param_1,(Vector *)&local_30);
  pcVar1 = (char *)KeyValues::GetString(*(KeyValues **)(this + 4),"angles","");
  local_30 = vec3_angle;
  local_2c = DAT_01053d40;
  local_28 = DAT_01053d44;
  sscanf(pcVar1,"%f %f %f",(Vector *)&local_30,puVar7,puVar6);
  CBaseEntity::SetAbsAngles(param_1,(QAngle *)&local_30);
  pcVar1 = (char *)KeyValues::GetString(*(KeyValues **)(this + 4),"vel","");
  local_30 = vec3_origin;
  local_2c = DAT_01053d4c;
  local_28 = DAT_01053d50;
  sscanf(pcVar1,"%f %f %f",(Vector *)&local_30,puVar7,puVar6);
  CBaseEntity::SetAbsVelocity(param_1,(Vector *)&local_30);
  uVar2 = KeyValues::GetString(*(KeyValues **)(this + 4),"model","");
  local_24 = 0;
  local_23 = 0xff;
  local_22 = 0xc0;
  local_21 = 0xff;
  ConColorMsg(&local_24,"Restoring prop_physics with model %s\n",uVar2);
  KeyValues::GetString(*(KeyValues **)(this + 4),"model","");
  AllocPooledString((char *)local_40);
  *(undefined1 **)(param_1 + 0x260) = local_40[0];
  CBaseEntity::DispatchUpdateTransmitState(param_1);
  puVar3 = &DAT_00d539c2;
  if (local_40[0] != (undefined1 *)0x0) {
    puVar3 = local_40[0];
  }
  iVar4 = (**(code **)(*soundemitterbase + 0x88))(soundemitterbase,puVar3);
  if (iVar4 != *(int *)(param_1 + 0xf4)) {
    if (param_1[0x6c] == (CBaseEntity)0x0) {
      this_00 = *(CBaseEdict **)(param_1 + 0x30);
      if (this_00 != (CBaseEdict *)0x0) {
        *(uint *)this_00 = *(uint *)this_00 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(this_00);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      param_1[0x70] = (CBaseEntity)((byte)param_1[0x70] | 1);
    }
    *(int *)(param_1 + 0xf4) = iVar4;
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)