L L4D2node

PhysModelCreate

0x00492680 · 865 bytes · __cdecl

_Z15PhysModelCreateP11CBaseEntityiRK6VectorRK6QAngleP7solid_tj

Decompiled

undefined (6 params)

/* PhysModelCreate(CBaseEntity*, int, Vector const&, QAngle const&, solid_t*, unsigned int) */

int * PhysModelCreate(CBaseEntity *param_1,int param_2,Vector *param_3,QAngle *param_4,
                     solid_t *param_5,uint param_6)

{
  code *pcVar1;
  int *piVar2;
  char cVar3;
  int iVar4;
  int *piVar5;
  uint uVar6;
  vcollide_t *pvVar7;
  undefined4 uVar8;
  uint uVar9;
  undefined *puVar10;
  undefined1 *puVar11;
  int in_GS_OFFSET;
  solid_t local_660 [1600];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((g_pPhys2World == (int *)0x0) ||
     (iVar4 = (**(code **)(*g_pPhys2World + 0x6c))(g_pPhys2World,0), iVar4 < 1)) {
LAB_004927c0:
    pvVar7 = (vcollide_t *)(**(code **)(*modelinfo + 0x18))(modelinfo,param_2);
    if (((pvVar7 != (vcollide_t *)0x0) && ((*(ushort *)pvVar7 & 0x7fff) != 0)) &&
       (*(int *)(pvVar7 + 4) != 0)) {
      if (param_5 == (solid_t *)0x0) {
        param_5 = local_660;
        cVar3 = PhysModelParseSolidByIndex(param_5,param_1,pvVar7,-1);
        if (cVar3 == '\0') goto LAB_004928a8;
      }
      uVar8 = 0xffffffff;
      if (param_5[0x400] != (solid_t)0x0) {
        uVar8 = (**(code **)(*physprops + 0x10))(physprops,param_5 + 0x400);
      }
      piVar5 = (int *)(**(code **)(*physenv + 0x20))
                                (physenv,*(undefined4 *)
                                          (*(int *)(pvVar7 + 4) + *(int *)(param_5 + 0x60c) * 4),
                                 uVar8,param_3,param_4,param_5 + 0x614);
      if (piVar5 != (int *)0x0) {
        pcVar1 = *(code **)(*modelinfo + 0x2c);
        uVar8 = (**(code **)(*modelinfo + 8))(modelinfo,param_2);
        iVar4 = (*pcVar1)(modelinfo,uVar8);
        if (iVar4 == 1) {
          uVar6 = (**(code **)(*modelinfo + 0x78))(modelinfo,param_2);
          if ((uVar6 & 0x4030) != 0) {
            uVar6 = uVar6 | 1;
          }
          uVar9 = (**(code **)(*piVar5 + 0xa4))(piVar5);
          if ((uVar6 != uVar9) && (uVar6 != 0)) {
            (**(code **)(*piVar5 + 0xa8))(piVar5,uVar6);
            (**(code **)(*piVar5 + 0x6c))(piVar5);
          }
        }
        (**(code **)(*g_pPhysSaveRestoreManager + 4))(g_pPhysSaveRestoreManager,piVar5,param_2);
        goto LAB_00492742;
      }
    }
  }
  else {
    piVar5 = (int *)Physics2ModelCreate(param_1,param_2,param_3,param_4,param_6);
    if (piVar5 != (int *)0x0) {
      if ((param_5 != (solid_t *)0x0) && (param_5[0x400] != (solid_t)0x0)) {
        (**(code **)(*piVar5 + 0x88))(piVar5,param_5 + 0x400);
      }
      uVar6 = *(uint *)(param_1 + 0x188);
      if ((((uVar6 != 0xffffffff) &&
           (puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
          && (*(uint *)(puVar10 + 8) == uVar6 >> 0xc)) &&
         ((*(int *)(puVar10 + 4) != 0 &&
          (piVar2 = *(int **)(*(int *)(puVar10 + 4) + 0x238), piVar2 != (int *)0x0)))) {
        uVar8 = (**(code **)(*piVar2 + 0x15c))(piVar2);
        (**(code **)(*g_pPhys2World + 0x7c))(g_pPhys2World,piVar5,uVar8,0);
      }
      piVar5 = (int *)(**(code **)(*piVar5 + 0x60))(piVar5);
      goto LAB_00492742;
    }
    uVar6 = (**(code **)(*(int *)(param_1 + 0x194) + 0x30))(param_1 + 0x194);
    if ((uVar6 & 0x1000) == 0) {
      puVar11 = &DAT_00d539c2;
      if (*(undefined1 **)(param_1 + 0x7c) != (undefined1 *)0x0) {
        puVar11 = *(undefined1 **)(param_1 + 0x7c);
      }
      uVar8 = CBaseEntity::GetDebugName(param_1);
      Warning("Cannot create non-solid physics object #%d %s:%s\n",param_2,uVar8,puVar11);
      goto LAB_004927c0;
    }
  }
LAB_004928a8:
  piVar5 = (int *)0x0;
LAB_00492742:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return piVar5;
}

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)