CBaseDoor::Spawn
0x00667aa0 · 1316 bytes · __thiscall
_ZN9CBaseDoor5SpawnEv
Decompiled
undefined (1 param)
/* WARNING: Removing unreachable block (ram,0x00667bba) */
/* WARNING: Removing unreachable block (ram,0x00667ff3) */
/* CBaseDoor::Spawn() */
void __thiscall CBaseDoor::Spawn(CBaseDoor *this)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
CBaseDoor CVar6;
uint uVar7;
code *pcVar8;
char cVar9;
undefined1 *puVar10;
undefined4 uVar11;
undefined *puVar12;
int iVar13;
bool bVar14;
float fVar15;
undefined1 *local_30 [2];
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
(**(code **)(*(int *)this + 0x6c))(this);
uVar7 = *(uint *)(this + 0x188);
if ((((uVar7 == 0xffffffff) ||
(puVar12 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar12 + 8) != uVar7 >> 0xc)) || (*(int *)(puVar12 + 4) == 0)) {
LAB_00667ae5:
CCollisionProperty::SetSolid((CCollisionProperty *)(this + 0x194),6);
}
else {
iVar13 = CBaseEntity::GetRootMoveParent((CBaseEntity *)this);
iVar13 = (**(code **)(*(int *)(iVar13 + 0x194) + 0x2c))(iVar13 + 0x194);
if (iVar13 != 1) goto LAB_00667ae5;
CCollisionProperty::SetSolid((CCollisionProperty *)(this + 0x194),1);
}
local_20 = *(undefined4 *)(this + 0x4cc);
local_24 = *(undefined4 *)(this + 0x4c8);
local_28 = *(undefined4 *)(this + 0x4c4);
AngleVectors((QAngle *)&local_28,(Vector *)(this + 0x4c4));
pcVar8 = *(code **)(*(int *)this + 0x70);
(**(code **)(*(int *)this + 0x20))(local_30,this);
puVar10 = &DAT_00d539c2;
if (local_30[0] != (undefined1 *)0x0) {
puVar10 = local_30[0];
}
(*pcVar8)(this,puVar10);
bVar14 = AllocTempVector()::s_vecTemp == '\0';
*(undefined4 *)(this + 0x454) = *(undefined4 *)(this + 0x39c);
*(undefined4 *)(this + 0x458) = *(undefined4 *)(this + 0x3a0);
*(undefined4 *)(this + 0x45c) = *(undefined4 *)(this + 0x3a4);
if ((bVar14) && (iVar13 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar13 != 0)) {
__cxa_guard_release(&AllocTempVector()::s_vecTemp);
}
if ((AllocTempVector()::s_nIndex == '\0') &&
(iVar13 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar13 != 0)) {
AllocTempVector()::s_nIndex = 0;
__cxa_guard_release(&AllocTempVector()::s_nIndex);
}
AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
LOCK();
UNLOCK();
fVar15 = *(float *)(this + 0x1a8);
iVar13 = AllocTempVector()::s_nIndex * 0xc;
fVar1 = *(float *)(this + 0x19c);
*(float *)(AllocTempVector()::s_vecTemp + iVar13) = fVar15 - fVar1;
fVar2 = *(float *)(this + 0x1ac);
fVar3 = *(float *)(this + 0x1a0);
*(float *)(AllocTempVector()::s_vecTemp + iVar13 + 4) = fVar2 - fVar3;
fVar4 = *(float *)(this + 0x1b0);
fVar5 = *(float *)(this + 0x1a4);
*(float *)(AllocTempVector()::s_vecTemp + iVar13 + 8) = fVar4 - fVar5;
fVar15 = ((ABS(((fVar15 - fVar1) + -2.0) * *(float *)(this + 0x4c4)) +
ABS(((fVar2 - fVar3) + -2.0) * *(float *)(this + 0x4c8))) - *(float *)(this + 0x44c)) +
ABS(((fVar4 - fVar5) + -2.0) * *(float *)(this + 0x4cc));
*(float *)(this + 0x464) = *(float *)(this + 0x458) + *(float *)(this + 0x4c8) * fVar15;
*(float *)(this + 0x468) = *(float *)(this + 0x45c) + *(float *)(this + 0x4cc) * fVar15;
*(float *)(this + 0x460) = fVar15 * *(float *)(this + 0x4c4) + *(float *)(this + 0x454);
cVar9 = (**(code **)(*(int *)this + 0x330))(this);
if (cVar9 == '\0') {
if ((*(int *)(this + 0x500) == 1) || (uVar7 = *(uint *)(this + 0x148), (uVar7 & 1) != 0)) {
UTIL_SetOrigin((CBaseEntity *)this,(Vector *)(this + 0x460),false);
uVar7 = *(uint *)(this + 0x148);
*(undefined4 *)(this + 0x440) = 0;
}
else {
*(undefined4 *)(this + 0x440) = 1;
}
}
else {
uVar7 = *(uint *)(this + 0x148);
}
if ((uVar7 & 0x800) != 0) {
Lock(this);
}
CBaseEntity::SetMoveType((CBaseEntity *)this,7,0);
if (*(float *)(this + 0x11c) == 0.0) {
*(undefined4 *)(this + 0x11c) = 0x42c80000;
}
*(code **)(this + 0xd8) = DoorTouch;
*(undefined4 *)(this + 0xdc) = 0;
if ((*(char **)(this + 0x7c) != "func_water") &&
(cVar9 = CBaseEntity::ClassMatchesComplex((CBaseEntity *)this,"func_water"), cVar9 == '\0')) {
if ((*(uint *)(this + 0x148) & 8) == 0) {
if ((*(uint *)(this + 0x148) & 4) != 0) goto LAB_00667f20;
LAB_00667db0:
CVar6 = this[0x4fd];
}
else {
*(uint *)(this + 0x14c) = *(uint *)(this + 0x14c) | 0x40000;
CCollisionProperty::SetSolidFlags
((CCollisionProperty *)(this + 0x194),(uint)(*(ushort *)(this + 0x1b4) | 4));
if ((*(uint *)(this + 0x148) & 4) == 0) goto LAB_00667db0;
LAB_00667f20:
CBaseEntity::SetCollisionGroup((CBaseEntity *)this,0xf);
CBaseEntity::AddFlag((CBaseEntity *)this,0x40000000);
CVar6 = this[0x4fd];
}
if (CVar6 != (CBaseDoor)0x0) {
if (((byte)this[0x148] & 4) != 0) {
uVar11 = CBaseEntity::GetDebugName((CBaseEntity *)this);
Warning("Door %s with conflicting collision settings, removing ignoredebris\n",uVar11);
iVar13 = *(int *)(this + 0x500);
goto joined_r0x00667dc0;
}
CBaseEntity::SetCollisionGroup((CBaseEntity *)this,4);
}
}
iVar13 = *(int *)(this + 0x500);
joined_r0x00667dc0:
if ((iVar13 == 1) && (((byte)this[0x148] & 1) != 0)) {
uVar11 = CBaseEntity::GetDebugName((CBaseEntity *)this);
Warning("Door %s using obsolete \'Start Open\' spawnflag with \'Spawn Position\' set to \'Open\'. Reverting to old behavior.\n"
,uVar11);
}
(**(code **)(*(int *)this + 0x290))(this);
*(undefined4 *)(this + 0x5fc) = 0;
if (((*(int *)(this + 0x440) == 1) &&
(cVar9 = (**(code **)(*(int *)this + 0x330))(this), cVar9 == '\0')) &&
((*(char **)(this + 0x7c) == "func_door" ||
(cVar9 = CBaseEntity::ClassMatchesComplex((CBaseEntity *)this,"func_door"), cVar9 != '\0'))))
{
BlockNavArea(this,true);
}
(**(code **)(*TheNavMesh + 0x98))(TheNavMesh,this);
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.