CPhysicsHook::LevelInitPreEntity
0x00778630 · 807 bytes · __thiscall
_ZN12CPhysicsHook18LevelInitPreEntityEv
Decompiled
undefined (1 param)
/* CPhysicsHook::LevelInitPreEntity() */
void __thiscall CPhysicsHook::LevelInitPreEntity(CPhysicsHook *this)
{
code *pcVar1;
int iVar2;
CBaseEntity *this_00;
vcollide_t *pvVar3;
undefined4 uVar4;
CEntityList *this_01;
undefined4 local_44 [3];
undefined4 local_38;
undefined4 local_34;
uint local_30;
undefined4 local_2c;
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
undefined4 local_1c;
undefined4 local_18;
undefined4 local_14;
undefined4 local_10;
if (g_pPhysics2 != (int *)0x0) {
(**(code **)(*g_pPhysics2 + 0x44))(g_pPhysics2,"LevelInitPreEntity",0);
if (g_pPhysics2 != (int *)0x0) {
/* try { // try from 00778677 to 007788fc has its CatchHandler @ 0077895f */
iVar2 = (**(code **)(*g_pPhysics2 + 0x5c))(g_pPhysics2,0);
if (4 < iVar2) goto LAB_00778683;
}
}
/* try { // try from 00778942 to 00778944 has its CatchHandler @ 0077895f */
physenv = (int *)(**(code **)(*physics + 0x14))(physics);
LAB_00778683:
if (g_pPhysics2 != (int *)0x0) {
g_pPhys2World =
(int *)(**(code **)(*g_pPhysics2 + 0x14))(g_pPhysics2,2,physenv,g_PhysWorldObject);
if (g_pPhys2World != (int *)0x0) {
(**(code **)(*enginetrace + 0x54))(enginetrace,g_pPhys2World);
}
}
g_EntityCollisionHash = (**(code **)(*physics + 0x20))(physics);
if (physenv == (int *)0x0) {
g_PhysWorldObject = 0;
}
else {
local_28 = 0xfa;
local_24 = 0x44fa0000;
local_20 = 0x45610000;
local_1c = 0x3f800000;
local_18 = 0x3f000000;
local_14 = 0x41200000;
local_10 = 0x451c4000;
local_2c = 10;
(**(code **)(*physenv + 0xf0))(physenv,&local_2c);
FactoryList_Retrieve((factorylist_t *)local_44);
(**(code **)(*physenv + 8))(physenv,local_44[0]);
(**(code **)(*physenv + 0xcc))(physenv,1);
(**(code **)(*physenv + 0x88))(physenv,0xfec304);
(**(code **)(*physenv + 0xa8))(physenv,g_Collisions);
(**(code **)(*physenv + 0xb0))(physenv,g_pConstraintEvents);
(**(code **)(*physenv + 0x108))(physenv,1);
(**(code **)(*physenv + 0xac))(physenv,0xfec308);
(**(code **)(*physenv + 0x98))(physenv,0x3c888889);
local_30 = *(uint *)(sv_gravity._28_4_ + 0x2c) ^ 0x80000000;
local_38 = 0;
local_34 = 0;
(**(code **)(*physenv + 0x10))(physenv,(PhysicsCollisionRulesCache_t *)&local_38);
this_00 = (CBaseEntity *)GetWorldEntity();
if (this_00 != (CBaseEntity *)0x0) {
CBaseEntity::GetPhysicsCollisionRulesCache(this_00,(PhysicsCollisionRulesCache_t *)&local_38);
}
(**(code **)*staticpropmgr)
(staticpropmgr,physenv,g_pPhys2World,&g_SolidSetup,this_00,
(PhysicsCollisionRulesCache_t *)&local_38);
pvVar3 = (vcollide_t *)(**(code **)(*modelinfo + 0x18))(modelinfo,1);
g_PhysWorldObject =
PhysCreateWorld_Shared(this_00,pvVar3,(objectparams_t *)&g_PhysDefaultObjectParams);
}
if (g_pPhys2World != (int *)0x0) {
pcVar1 = *(code **)(*g_pPhys2World + 0x8c);
uVar4 = GetWorldEntity();
(*pcVar1)(g_pPhys2World,physenv,g_PhysWorldObject,uVar4);
}
g_PhysAverageSimTime = 0;
this_01 = ::operator_new(8);
/* try { // try from 00778902 to 00778906 has its CatchHandler @ 0077897b */
CEntityList::CEntityList(this_01);
g_pShadowEntities = this_01;
/* try { // try from 0077890d to 00778911 has its CatchHandler @ 0077895f */
PrecachePhysicsSounds();
this[0x58] = (CPhysicsHook)0x1;
if (g_pPhysics2 != (int *)0x0) {
(**(code **)(*g_pPhysics2 + 0x48))(g_pPhysics2);
}
return;
}
SourceMod gamedata
paste intoaddons/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.
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.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.