CStaticProp::CreateVPhysicsInternal
0x001e5550 · 1296 bytes · __thiscall
_ZN11CStaticProp22CreateVPhysicsInternalEP19IPhysicsEnvironmentP14IPhysics2WorldP19IVPhysicsKeyHandlerP11CBaseEntity
Decompiled
undefined (5 params)
/* CStaticProp::CreateVPhysicsInternal(IPhysicsEnvironment*, IPhysics2World*, IVPhysicsKeyHandler*,
CBaseEntity*) */
int * __thiscall
CStaticProp::CreateVPhysicsInternal
(CStaticProp *this,IPhysicsEnvironment *param_1,IPhysics2World *param_2,
IVPhysicsKeyHandler *param_3,CBaseEntity *param_4)
{
CStaticProp CVar1;
char cVar2;
int *piVar3;
char *pcVar4;
undefined4 uVar5;
int iVar6;
uint uVar7;
void *pvVar8;
model_t *pmVar9;
int iVar10;
uint uVar11;
int in_GS_OFFSET;
undefined4 local_784;
char *local_778;
uint local_774;
undefined4 local_768;
char local_764 [260];
undefined1 local_660 [512];
undefined1 local_460;
undefined1 local_260 [532];
undefined4 local_4c;
undefined4 local_48;
undefined4 local_44;
undefined4 local_40;
undefined4 local_3c;
undefined4 local_38;
char *local_34;
CBaseEntity *local_30;
undefined4 local_2c;
undefined4 local_28;
undefined1 local_24;
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (g_pPhysics2 != (int *)0x0) {
(**(code **)(*g_pPhysics2 + 0x44))(g_pPhysics2,"/data/src/engine/./staticpropmgr.cpp",0x523);
}
CVar1 = this[0x39];
if (CVar1 != (CStaticProp)0x0) {
local_260[0] = 0;
local_460 = 0;
local_660[0] = 0;
pmVar9 = *(model_t **)(this + 0x28);
if (pmVar9 == (model_t *)0x0) {
pcVar4 = "unknown model";
if (CVar1 != (CStaticProp)0x2) goto LAB_001e581c;
local_778 = "prop_static";
local_774 = 0xffffffff;
iVar10 = 0;
LAB_001e59fb:
local_784 = (**(code **)(*physcollision + 0x78))(physcollision,iVar10 + 0x118,iVar10 + 0x124);
local_4c = 0;
local_48 = 0x3f800000;
local_44 = 0x3f800000;
local_40 = 0x3dcccccd;
local_3c = 0x3dcccccd;
local_38 = 0x3d4ccccd;
local_2c = 0;
local_28 = 0x3f800000;
}
else {
iVar10 = 0;
if (CVar1 == (CStaticProp)0x6) {
iVar10 = CM_VCollideForModel(-1,pmVar9);
pmVar9 = *(model_t **)(this + 0x28);
}
if (*(int *)(pmVar9 + 0x110) == 3) {
if (*(short *)(pmVar9 + 0x134) == -1) {
local_774 = 0xffffffff;
goto LAB_001e5618;
}
iVar6 = (**(code **)(*mdlcache + 0x28))(mdlcache,*(short *)(pmVar9 + 0x134));
local_778 = (char *)(iVar6 + 0xc);
local_774 = *(uint *)(iVar6 + 0x14c);
}
else {
local_774 = 0xffffffff;
if (*(int *)(pmVar9 + 0x110) == 1) {
local_774 = *(uint *)((uint)*(ushort *)(pmVar9 + 0x14a) * 0x40 +
*(int *)(*(int *)(pmVar9 + 0x134) + 0x50));
}
LAB_001e5618:
local_778 = "prop_static";
}
if (iVar10 == 0) {
iVar10 = *(int *)(this + 0x28);
if (this[0x39] == (CStaticProp)0x2) goto LAB_001e59fb;
if (iVar10 == 0) {
pcVar4 = "unknown model";
}
else {
pcVar4 = (char *)(**(code **)(*(int *)modelloader + 0x10))(modelloader,iVar10);
}
LAB_001e581c:
V_strncpy(local_764,pcVar4,0x104);
Warning("Map Error: Static prop with bogus solid type %d! (%s)\n",this[0x39],local_764);
this[0x39] = (CStaticProp)0x0;
goto LAB_001e56df;
}
local_784 = **(undefined4 **)(iVar10 + 4);
/* try { // try from 001e5639 to 001e56ca has its CatchHandler @ 001e5a6f */
piVar3 = (int *)(**(code **)(*physcollision + 0xa0))(physcollision,iVar10);
while (cVar2 = (**(code **)(*piVar3 + 0xc))(piVar3), cVar2 == '\0') {
pcVar4 = (char *)(**(code **)(*piVar3 + 8))(piVar3);
iVar10 = _V_stricmp(pcVar4,"solid");
if (iVar10 == 0) {
(**(code **)(*piVar3 + 0x10))(piVar3,local_660,param_3);
break;
}
(**(code **)(*piVar3 + 0x28))(piVar3);
}
(**(code **)(*physcollision + 0xa4))(physcollision,piVar3);
}
local_24 = 1;
local_30 = param_4;
local_34 = "prop_static";
uVar5 = (**(code **)(*physprops + 0x10))(physprops,local_260);
if ((param_2 == (IPhysics2World *)0x0) ||
(iVar10 = (**(code **)(*(int *)param_2 + 0x6c))(param_2,0), iVar10 < 1)) {
/* try { // try from 001e5744 to 001e5a1c has its CatchHandler @ 001e5a6f */
piVar3 = (int *)(**(code **)(*(int *)param_1 + 0x24))
(param_1,local_784,uVar5,this + 0x10,this + 0x1c,&local_4c);
(**(code **)(*piVar3 + 0xa8))(piVar3,local_774);
if ((local_774 & 1) != 0) {
(**(code **)(*piVar3 + 0x154))(piVar3,2);
}
goto LAB_001e56e1;
}
if (((*(int *)(phys2_merge_static_props._28_4_ + 0x30) == 0) &&
(iVar10 = (**(code **)(*g_pMDLCache + 0x34))
(g_pMDLCache,*(undefined2 *)(*(int *)(this + 0x28) + 0x134),1),
iVar10 != 0)) && (uVar7 = (uint)*(ushort *)(iVar10 + 2), uVar7 != 0)) {
pvVar8 = operator_new__(uVar7 << 2);
*(void **)(this + 0x30) = pvVar8;
*(uint *)(this + 0x34) = uVar7;
uVar11 = 0;
do {
local_768 = *(undefined4 *)(*(int *)(iVar10 + 8) + uVar11 * 4);
piVar3 = (int *)(**(code **)(*(int *)param_2 + 0x38))
(param_2,&local_768,1,this + 0x10,this + 0x1c,1);
(**(code **)(*piVar3 + 0x3c))(piVar3,"%s shape %d @%p",local_778,uVar11,piVar3);
*(int **)(*(int *)(this + 0x30) + uVar11 * 4) = piVar3;
piVar3 = (int *)(**(code **)(*piVar3 + 0x60))(piVar3);
uVar11 = uVar11 + 1;
} while (uVar11 < uVar7);
goto LAB_001e56e1;
}
}
LAB_001e56df:
piVar3 = (int *)0x0;
LAB_001e56e1:
if (g_pPhysics2 != (int *)0x0) {
(**(code **)(*g_pPhysics2 + 0x48))(g_pPhysics2);
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return piVar3;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.